|
|
вернуться в форумNumbers input Послано Амаяк 6 дек 2022 11:55 How do I get an unlimited length array from the console so that the test starts? What is the end character of the input? Re: Numbers input When you use scanf(), generall you can check the return value of scanf(). If the return value is equal to -1, it means that it gets the end of input. Besides, you when you use cin, you can just judge if the input is end by the return value of cin is 0 or not. If it is 0, it means the end. eg: int main(){ int n; while(scanf("%d", &n) != -1){ .... } } and int main(){ int n; while(cin >> n){ .... } } |
|
|