Firstly looking at your code, you're already doing some incorrect things.
int main() {
using namespace std;
ifstream inf("sum.ccp");
while (inf) {
std:: string strInput;
inf >> strInput;
cout << strInput << endl;
}
You need to have using namespace std outside of your main method in order to use the majority of basic C++ commands without tacking on std:: to the beginning. So place it underneath all of the "#include" directives.
Secondly, you should make the variable you're using to take in all of the values an integer, and then simply print the number to the screen with a simple cout command.
The hardest part about your assignment here is just taking the numbers from a text file and using them as integers.
Even then, that's pretty easy. Something like this, using ifstream since you're reading from a file.
ifstream inputFile;
inputFile.open(*your file name here, which should be a .txt file.
I think it works w/ .doc files as well,
but just use a .txt file to be safe.)
After that the process is pretty simple. You do use a while loop, but in this case you use the string insertion operator (the double arrows >>), like so:
while(inputFile >> //your number variable)
This lets the text file keep looping your stuff, while also inserting the value into the variable from the start. So from there you can just print it to the screen, tally up the total, and then after the loop you can print the total the screen.
Hope that helps!