Click here to Skip to main content
15,904,023 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: problem with stack structure in C++(using pointer), plz help !!! Pin
hung2h19-Jan-10 23:43
hung2h19-Jan-10 23:43 
AnswerRe: problem with stack structure in C++(using pointer), plz help !!! Pin
CPallini19-Jan-10 23:44
mveCPallini19-Jan-10 23:44 
GeneralRe: problem with stack structure in C++(using pointer), plz help !!! Pin
Tim Craig20-Jan-10 12:55
Tim Craig20-Jan-10 12:55 
GeneralRe: problem with stack structure in C++(using pointer), plz help !!! Pin
CPallini20-Jan-10 21:32
mveCPallini20-Jan-10 21:32 
QuestionMessage Removed Pin
19-Jan-10 22:40
Mishgun5619-Jan-10 22:40 
AnswerRe: The problem with including headers in C++ Pin
Stuart Dootson19-Jan-10 22:48
professionalStuart Dootson19-Jan-10 22:48 
AnswerRe: The problem with including headers in C++ Pin
Stephen Hewitt19-Jan-10 22:50
Stephen Hewitt19-Jan-10 22:50 
GeneralRe: The problem with including headers in C++ Pin
Mishgun5619-Jan-10 22:56
Mishgun5619-Jan-10 22:56 
QuestionSwitching on and setting baud rate [modified] Pin
CodeyBlank19-Jan-10 21:28
CodeyBlank19-Jan-10 21:28 
AnswerRe: Switching on and setting baud rate Pin
Richard MacCutchan19-Jan-10 22:27
mveRichard MacCutchan19-Jan-10 22:27 
GeneralRe: Switching on and setting baud rate Pin
Garth J Lancaster19-Jan-10 22:30
professionalGarth J Lancaster19-Jan-10 22:30 
GeneralRe: Switching on and setting baud rate Pin
Richard MacCutchan20-Jan-10 0:43
mveRichard MacCutchan20-Jan-10 0:43 
GeneralRe: Switching on and setting baud rate Pin
CPallini20-Jan-10 3:01
mveCPallini20-Jan-10 3:01 
GeneralRe: Switching on and setting baud rate Pin
Richard MacCutchan20-Jan-10 3:30
mveRichard MacCutchan20-Jan-10 3:30 
AnswerRe: Switching on and setting baud rate Pin
Garth J Lancaster19-Jan-10 22:30
professionalGarth J Lancaster19-Jan-10 22:30 
GeneralRe: Switching on and setting baud rate Pin
CodeyBlank19-Jan-10 22:43
CodeyBlank19-Jan-10 22:43 
GeneralRe: Switching on and setting baud rate Pin
Garth J Lancaster19-Jan-10 22:55
professionalGarth J Lancaster19-Jan-10 22:55 
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.

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.