Click here to Skip to main content
15,884,353 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Parent Forms Pin
Sarriss30-Sep-08 11:04
Sarriss30-Sep-08 11:04 
QuestionTracking application memory usage Pin
JoeSchmoe00730-Sep-08 5:25
JoeSchmoe00730-Sep-08 5:25 
AnswerRe: Tracking application memory usage Pin
Rick York30-Sep-08 6:17
mveRick York30-Sep-08 6:17 
GeneralRe: Tracking application memory usage Pin
JoeSchmoe00730-Sep-08 6:59
JoeSchmoe00730-Sep-08 6:59 
AnswerRe: Tracking application memory usage Pin
David Crow30-Sep-08 10:19
David Crow30-Sep-08 10:19 
AnswerRe: Tracking application memory usage Pin
Naveen30-Sep-08 14:03
Naveen30-Sep-08 14:03 
QuestionAccepting a drag/drop from a camera drive Pin
Felix_H30-Sep-08 5:22
Felix_H30-Sep-08 5:22 
Questionfor... loop to while loop Pin
Mghand30-Sep-08 5:02
Mghand30-Sep-08 5:02 
Hey all, first year CS 1 student here and i am having some problems with my latest project
purpose of project: create 100 random numbers and display them in txtLog
i'm trying to change this for loop to a while... loop:
private: System::Void btnCreate_Click(System::Object^  sender, System::EventArgs^  e) {
int items;
double thick;
Int32::TryParse(txtItems->Text, items);
for (int i = 0; i<items;>{
thick = randomNumGen->Next(0,1000)/100.00;
strLog += "Chump  " + i + ":\t" + thick + " mm\r\n";
}
txtLog->Text = strLog;


what i've come up with is this:

private: System::Void btnCreate_Click(System::Object^  sender, System::EventArgs^  e) {
double thick;

int i = 0;
int items = 0;
while (items > 1000);
{
thick = randomNumGen->Next(0,1000)/100.00;
strLog += "Chump  " + i + ":\t" + thick + " mm\r\n";
}
txtLog->Text = strLog;

It seems to work, i get no errors, but when running and clicking btnCreate, it only lists 1 random number "Chump 0 - random number" instead of 100 random numbers in txtLog "Chump 0 - random number, chump 1, chump 2, up to 99 etc". I think that i went completely wrong when i changed it, do i need to assign i = 0 or items = 0 etc. ?

Sorry if i did this wrong! i've only been programming for a month now!

if you need more info just ask!
QuestionRe: for... loop to while loop Pin
led mike30-Sep-08 5:10
led mike30-Sep-08 5:10 
AnswerRe: for... loop to while loop Pin
toxcct30-Sep-08 5:18
toxcct30-Sep-08 5:18 
GeneralRe: for... loop to while loop Pin
Mghand30-Sep-08 5:43
Mghand30-Sep-08 5:43 
AnswerRe: for... loop to while loop Pin
David Crow30-Sep-08 10:20
David Crow30-Sep-08 10:20 
GeneralRe: for... loop to while loop Pin
toxcct30-Sep-08 22:03
toxcct30-Sep-08 22:03 
QuestionSubitem hiliting in CListCtrl Pin
josip cagalj30-Sep-08 2:29
josip cagalj30-Sep-08 2:29 
AnswerRe: Subitem hiliting in CListCtrl Pin
led mike30-Sep-08 4:25
led mike30-Sep-08 4:25 
GeneralRe: Subitem hiliting in CListCtrl Pin
josip cagalj30-Sep-08 20:59
josip cagalj30-Sep-08 20:59 
AnswerRe: Subitem hiliting in CListCtrl [modified] Pin
Naveen30-Sep-08 20:27
Naveen30-Sep-08 20:27 
GeneralRe: Subitem hiliting in CListCtrl Pin
josip cagalj30-Sep-08 21:43
josip cagalj30-Sep-08 21:43 
GeneralRe: Subitem hiliting in CListCtrl Pin
Naveen30-Sep-08 21:55
Naveen30-Sep-08 21:55 
GeneralRe: Subitem hiliting in CListCtrl [modified] Pin
josip cagalj30-Sep-08 22:12
josip cagalj30-Sep-08 22:12 
GeneralRe: Subitem hiliting in CListCtrl Pin
Naveen30-Sep-08 22:29
Naveen30-Sep-08 22:29 
GeneralRe: Subitem hiliting in CListCtrl Pin
josip cagalj1-Oct-08 3:07
josip cagalj1-Oct-08 3:07 
GeneralRe: Subitem hiliting in CListCtrl Pin
Naveen1-Oct-08 14:18
Naveen1-Oct-08 14:18 
GeneralRe: Subitem hiliting in CListCtrl Pin
josip cagalj1-Oct-08 22:42
josip cagalj1-Oct-08 22:42 
GeneralRe: Subitem hiliting in CListCtrl Pin
Naveen1-Oct-08 22:54
Naveen1-Oct-08 22:54 

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.