Click here to Skip to main content
15,895,777 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to unlock locked file using Win32 API? Pin
kilt14-Sep-09 2:21
kilt14-Sep-09 2:21 
QuestionBeginner's Question 2 Pin
UKM_Student11-Sep-09 4:37
UKM_Student11-Sep-09 4:37 
AnswerRe: Beginner's Question 2 Pin
David Crow11-Sep-09 4:41
David Crow11-Sep-09 4:41 
GeneralRe: Beginner's Question 2 Pin
UKM_Student11-Sep-09 4:44
UKM_Student11-Sep-09 4:44 
GeneralRe: Beginner's Question 2 Pin
David Crow11-Sep-09 4:48
David Crow11-Sep-09 4:48 
GeneralRe: Beginner's Question 2 Pin
UKM_Student11-Sep-09 4:56
UKM_Student11-Sep-09 4:56 
GeneralRe: Beginner's Question 2 Pin
UKM_Student11-Sep-09 4:55
UKM_Student11-Sep-09 4:55 
GeneralRe: Beginner's Question 2 Pin
David Crow11-Sep-09 5:13
David Crow11-Sep-09 5:13 
UKM_Student wrote:
why is it wrong?


Because you wanted to use a while() loop to sum N1, N2, and N3. Given:

int N1, N2, N3;
while ()
{
    // what would go here?
}
How would that work?

UKM_Student wrote:
cout<<"Input 5 numbers.";


This should probably go outside the while() loop.

UKM_Student wrote:
My question is how should i put it so it would display" total: N1+N2+N3+N4+N5=XX "instead of adding all the numbers up then display "total:XX"


Given that you are not saving number each time through the loop, you can't.

Consider:

int count = 0, number[5];
  
while (count < 5)
{
    cin >> number[count];
    total += number[count];
    count++;
}
  
cout << endl << "total: ";
  
count = 0;
while (count < 5)
{
    cout << number[count];
    if (count < 4)
        cout << '+';
}
  
cout << '=' << total;


"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons


GeneralRe: Beginner's Question 2 Pin
UKM_Student11-Sep-09 5:23
UKM_Student11-Sep-09 5:23 
GeneralRe: Beginner's Question 2 Pin
Richard MacCutchan11-Sep-09 5:28
mveRichard MacCutchan11-Sep-09 5:28 
GeneralRe: Beginner's Question 2 Pin
UKM_Student13-Sep-09 4:34
UKM_Student13-Sep-09 4:34 
GeneralRe: Beginner's Question 2 Pin
Richard MacCutchan13-Sep-09 4:58
mveRichard MacCutchan13-Sep-09 4:58 
GeneralRe: Beginner's Question 2 Pin
UKM_Student13-Sep-09 23:48
UKM_Student13-Sep-09 23:48 
QuestionRe: Beginner's Question 2 Pin
David Crow11-Sep-09 5:40
David Crow11-Sep-09 5:40 
AnswerRe: Beginner's Question 2 Pin
UKM_Student11-Sep-09 5:45
UKM_Student11-Sep-09 5:45 
QuestionRe: Beginner's Question 2 Pin
David Crow11-Sep-09 5:54
David Crow11-Sep-09 5:54 
AnswerRe: Beginner's Question 2 Pin
UKM_Student11-Sep-09 6:16
UKM_Student11-Sep-09 6:16 
QuestionRe: Beginner's Question 2 Pin
David Crow11-Sep-09 6:21
David Crow11-Sep-09 6:21 
AnswerRe: Beginner's Question 2 Pin
UKM_Student11-Sep-09 6:26
UKM_Student11-Sep-09 6:26 
GeneralRe: Beginner's Question 2 Pin
David Crow11-Sep-09 6:32
David Crow11-Sep-09 6:32 
GeneralRe: Beginner's Question 2 Pin
UKM_Student11-Sep-09 6:38
UKM_Student11-Sep-09 6:38 
GeneralRe: Beginner's Question 2 Pin
UKM_Student11-Sep-09 5:27
UKM_Student11-Sep-09 5:27 
QuestionRe: Beginner's Question 2 Pin
David Crow11-Sep-09 5:35
David Crow11-Sep-09 5:35 
AnswerRe: Beginner's Question 2 Pin
UKM_Student11-Sep-09 5:44
UKM_Student11-Sep-09 5:44 
QuestionHow to control the size of MessageBox Pin
Software200711-Sep-09 3:21
Software200711-Sep-09 3:21 

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.