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.
#include <iostream>
usingnamespace 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;
}