Click here to Skip to main content
15,881,424 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGenetic Prorgaming Pin
bluatigro9-Oct-17 2:19
bluatigro9-Oct-17 2:19 
AnswerRe: Genetic Prorgaming Pin
David Crow9-Oct-17 2:39
David Crow9-Oct-17 2:39 
QuestionWhile loop not working on C. Pin
Tarun Jha8-Oct-17 0:23
Tarun Jha8-Oct-17 0:23 
AnswerRe: While loop not working on C. Pin
Richard MacCutchan8-Oct-17 1:45
mveRichard MacCutchan8-Oct-17 1:45 
GeneralRe: While loop not working on C. Pin
Tarun Jha8-Oct-17 3:36
Tarun Jha8-Oct-17 3:36 
GeneralRe: While loop not working on C. Pin
Richard MacCutchan8-Oct-17 6:15
mveRichard MacCutchan8-Oct-17 6:15 
GeneralRe: While loop not working on C. Pin
Tarun Jha8-Oct-17 6:24
Tarun Jha8-Oct-17 6:24 
GeneralRe: While loop not working on C. Pin
geodoom12-Oct-17 12:12
geodoom12-Oct-17 12:12 
First suspicious point : you declare i but you do not initialize it (you also declare j but at least you plan to initialize it in the for loop so it is acceptable).
Second suspicious point: you are to hasty to increment i. If you want to insist using a
C++
do {
... 
} while (condition)

loop , and not a
C++
while (condition) 
{ ... }

then you must realize that you need to check the value just read (if it was zero) and then , if it not 0 , meaning the user want to keep giving values , increase i++ , getting ready for reading the next element.
Try to implement those 2 points , and also as an extra exercise , implement the
while(condition) {
...
}
It is not hard, you can do it in around half an hour or less, and you will benefit a lot by pondering on how it will differ from your
do { ... } while(condition)
GeneralRe: While loop not working on C. Pin
Tarun Jha13-Oct-17 5:40
Tarun Jha13-Oct-17 5:40 
AnswerRe: While loop not working on C. Pin
«_Superman_»8-Oct-17 17:59
professional«_Superman_»8-Oct-17 17:59 
GeneralRe: While loop not working on C. Pin
Tarun Jha10-Oct-17 5:24
Tarun Jha10-Oct-17 5:24 
AnswerRe: While loop not working on C. Pin
Tarun Jha11-Oct-17 7:15
Tarun Jha11-Oct-17 7:15 
SuggestionRe: While loop not working on C. Pin
David Crow11-Oct-17 7:46
David Crow11-Oct-17 7:46 
GeneralRe: While loop not working on C. Pin
geodoom13-Oct-17 7:24
geodoom13-Oct-17 7:24 
GeneralRe: While loop not working on C. Pin
Tarun Jha13-Oct-17 7:26
Tarun Jha13-Oct-17 7:26 
AnswerRe: While loop not working on C. Pin
Manish K. Agarwal12-Oct-17 4:33
Manish K. Agarwal12-Oct-17 4:33 
GeneralRe: While loop not working on C. Pin
Tarun Jha13-Oct-17 5:46
Tarun Jha13-Oct-17 5:46 
GeneralRe: While loop not working on C. Pin
David Crow13-Oct-17 16:13
David Crow13-Oct-17 16:13 
AnswerRe: While loop not working on C. Pin
asa7612-Oct-17 6:33
asa7612-Oct-17 6:33 
QuestionRe: While loop not working on C. Pin
David Crow13-Oct-17 2:40
David Crow13-Oct-17 2:40 
QuestionCTreeObject class Pin
_Flaviu3-Oct-17 22:59
_Flaviu3-Oct-17 22:59 
AnswerRe: CTreeObject class Pin
«_Superman_»3-Oct-17 23:07
professional«_Superman_»3-Oct-17 23:07 
GeneralRe: CTreeObject class Pin
_Flaviu5-Oct-17 21:38
_Flaviu5-Oct-17 21:38 
QuestionCImage processing Pin
rbrunton3-Oct-17 2:03
rbrunton3-Oct-17 2:03 
GeneralRe: CImage processing Pin
Richard MacCutchan3-Oct-17 7:53
mveRichard MacCutchan3-Oct-17 7:53 

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.