can you solve this task?

Can you help me with this task?
Thank you!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
text of the task

Entries are integers while zero is inputted. Write a program that shows how the entered numbers, excluding zero.
entrance

Each line of input except the last, contains an integer different from zero. The last line contains a zero.
Exit

In the standard output in the first line to show how much is loaded numbers, excluding zero.
example 1

input

5
12
-5
675
-123
0

output

5
Last edited on
Sorry, we don't do tasks for you here. Learn how to program, use the tutorials on this wesbite - http://www.cplusplus.com/doc/tutorial/basic_io/

Or watch youtube tutorials, whichever you prefer.

Work on the problem yourself, write a program. If you run into problems, feel free to post your code with the errors/questions.

Goodluck!
Sorry man, I did it!

1
2
3
4
5
6
7
8
9
int n[300], i;

    for(i=0; i<=300; i++){
        cin >> n[i];
        if(n[i] == 0){
            cout << i << endl;
            break;
        }
    }
Topic archived. No new replies allowed.