Click here to Skip to main content
15,887,302 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionSplit multi image tiff file using CXImage Pin
Pryabu19-Jan-10 17:30
Pryabu19-Jan-10 17:30 
AnswerRe: Split multi image tiff file using CXImage Pin
Game-point19-Jan-10 21:07
Game-point19-Jan-10 21:07 
GeneralRe: Split multi image tiff file using CXImage Pin
Pryabu20-Jan-10 1:33
Pryabu20-Jan-10 1:33 
GeneralRe: Split multi image tiff file using CXImage Pin
PJ Arends20-Jan-10 5:28
professionalPJ Arends20-Jan-10 5:28 
QuestionDEBUG_NEW [modified] Pin
iceman861619-Jan-10 15:07
iceman861619-Jan-10 15:07 
AnswerRe: DEBUG_NEW Pin
Chris Losinger19-Jan-10 16:59
professionalChris Losinger19-Jan-10 16:59 
GeneralRe: DEBUG_NEW Pin
iceman861620-Jan-10 13:55
iceman861620-Jan-10 13:55 
QuestionProgram Which: Takes numbers from a user, and sum's them. Pin
rbwest8619-Jan-10 13:44
rbwest8619-Jan-10 13:44 
Hello all,

I am working on my homework for my C++ programming class and I am hitting a brick wall. Everywhere I look online does not seem to have any information in which I can apply to my program. I am supposed to use a "while" loop which I am, and thats working.

The part which is not working is the users input should add it to the previous entry, and after the user types "0" it will display the sum on the screen. I have looked at the following references to try and make sense of things:
http://www.cplusplus.com/reference/std/numeric/partial_sum/[^]
http://www.cplusplus.com/reference/std/numeric/accumulate/[^]
http://frank.mtsu.edu/~csci117/manual/lab7/lab7.html[^]
I am trying very hard to understand this, but I can not find a good online reference of the libraries. www.cplusplus.com is very good but dosent have the info I need, or more than likely I can not find it.

But here is the code to which I am trying to correct:
#include <iostream>
#include <string>

using namespace std;

int main()
{

// Global Variables
int userinput;
int sum = 0;
sum = sum + userinput;


// Start While loop
while (userinput != 0)
{
// Prompt User for input
cout << "Please enter a number. When you are finished, type 0 and press Enter." ;
cin >> ++userinput ;    

}
cout << "The sum is:" << sum << endl;
return 0;
}


Thank's to all in advance for pointing me in the correct direction so I can figure this out. I should have put this at the top: I DO NOT WANT THE ANSWER, I WOULD PREFER THE REFERENCE TO FIND MY OWN.
AnswerRe: Program Which: Takes numbers from a user, and sum's them. Pin
loyal ginger19-Jan-10 14:53
loyal ginger19-Jan-10 14:53 
GeneralRe: Program Which: Takes numbers from a user, and sum's them. Pin
rbwest8619-Jan-10 15:46
rbwest8619-Jan-10 15:46 
GeneralRe: Program Which: Takes numbers from a user, and sum's them. Pin
loyal ginger20-Jan-10 15:18
loyal ginger20-Jan-10 15:18 
AnswerRe: Program Which: Takes numbers from a user, and sum's them. Pin
rbwest8619-Jan-10 16:40
rbwest8619-Jan-10 16:40 
GeneralRe: Program Which: Takes numbers from a user, and sum's them. Pin
Wes Aday19-Jan-10 17:05
professionalWes Aday19-Jan-10 17:05 
AnswerFunction pointer + template = INTERNAL COMPILER ERROR [answered] Pin
Code-o-mat19-Jan-10 6:35
Code-o-mat19-Jan-10 6:35 
GeneralRe: Function pointer + template = INTERNAL COMPILER ERROR [answered] Pin
CODEPC19-Jan-10 7:49
CODEPC19-Jan-10 7:49 
GeneralRe: Function pointer + template = INTERNAL COMPILER ERROR [answered] Pin
Code-o-mat19-Jan-10 8:03
Code-o-mat19-Jan-10 8:03 
QuestionProgramming MS Visual C++, David J. Kruglinski - missing files needed Pin
andwan019-Jan-10 5:27
andwan019-Jan-10 5:27 
QuestionInternetOpenUrl with proxy Pin
YaronNir19-Jan-10 4:31
YaronNir19-Jan-10 4:31 
AnswerRe: InternetOpenUrl with proxy Pin
YaronNir19-Jan-10 20:22
YaronNir19-Jan-10 20:22 
QuestionwaveOutWrite Problem Pin
Aric Wang19-Jan-10 3:59
Aric Wang19-Jan-10 3:59 
AnswerRe: waveOutWrite Problem Pin
Covean19-Jan-10 4:08
Covean19-Jan-10 4:08 
GeneralRe: waveOutWrite Problem Pin
Aric Wang19-Jan-10 4:27
Aric Wang19-Jan-10 4:27 
GeneralRe: waveOutWrite Problem Pin
Aric Wang20-Jan-10 17:44
Aric Wang20-Jan-10 17:44 
GeneralRe: waveOutWrite Problem Pin
Covean20-Jan-10 22:54
Covean20-Jan-10 22:54 
AnswerRe: waveOutWrite Problem Pin
molesworth19-Jan-10 5:00
molesworth19-Jan-10 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.