suagbor: please tell us what you are allowed to use? Do you know arrays and loops?
I would recommend you to look into some beginner tutorials, where they explain how a program is structed. I will tell you only what roughly need to know:
A executable program always needs a 'main function' in C++. So these 4 lines are already valid code and compilable sourcecode.
1 2 3 4
int main()
{
return 0;
}
Now lets think what you need for input. To print something out or read in you certainly need some 'objects' like cin and cout (pronounced: see-in, see-out) Here i a little sample code you can type into your IDE or your most trustworthy texteditor. I hope you know how to compile programs.
1 2 3 4 5 6 7 8 9 10 11 12
#include <iostream> // here we get our objects cin and cout from. this makes them available
using namepsace std; // some technical reason to write this here, dont bother with this
int main()
{
int a;
cout << "Hey i write something to console.\nType some integer:";
cin >> a;
cout << "Wow! " << a << " is a really great number!\n";
return 0;
}
Don't double post. Your question should be posted exactly once across this entire website and once only.
There are a vast number of means to do this problem. The one with the smallest memory footprint, and the one that I would probably prefer in this case due to minimum code typing, is to create a for loop that executes ten times, and each time, get a number (to the same variable). After getting another number, add it onto a total (compound assignment operator, look it up if you don't recognize +=) and go around again.