Two exercises

Hi I just started a course on C++ programming and I am struggling I am stuck on two exercises any help would be appreciated.

1.Enter series of numbers and when the user enters 0, stop it and sum-up all the numbers.

2. List numbers from 0 - 100, where sum of first and second number is odd number.

PS we got to for and while function.

Make an attempt at completing these two exercises. A real attempt, involving time and effort, and keeping in mind examples of code you've presumably already seen. Then, if you still can't crack the nut, post your work. Between code tags, please.
Ok, but i lost two days trying to finish these tasks.
im quite new to programming C++
but this 1st assignment is like super easy if you read into how loops work

still if anybody more experienced can refine this piece of code that would help me too :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;

int input;
int sum = 0;
void calc(){
    cout << "enter a  number " << endl;

    cin >> input;
}

int main(){
    cout << "press 0 to calculate all numbers " << endl;
calc();
while (input != 0){

    sum = sum + input;
    calc();
}
cout << sum;
return 0;
}
Topic archived. No new replies allowed.