1. now it sais that case 'S': is not included in the switch statement...

2. nevermind..its working now. just that its always doing defualt..never the cases...

3. why don't you make sure that all the cases look like this

switch(entry):
{

case 'A':
case 'a':
{
cout << "blah";
break;
}

that way you're sure its not your caps lock or anything....then lemme know how it is....

*you have been e-mail that i replied because i set it up so that you would be....

4. heh yea i know.that wuz funky "You got a new thread reply" heh. Yea i got it workin a few hours ago...now im having big problems with looping it so theres an option to restart the program. I just DONT get how to do it...some other dude explained it ..kind of...but i didnt understand it...do you think you could help me?

5. check out your other thread...it links to the tutorials on the main site, they're good...if you still have problems PM me or put it up here...I'mm be on for a bout another 15 min or so and maybe some tonight..

6. k i took a look...this stuff is confusin..im only 12...2 much for my little brain heh as i posted on the other thread...do u think u could go through each block of code to make me understand it? id really appreciate it

7. yup....here we go....don't have time to do all three kinds of loops so I'm just gonna do a for loop for now....I'll show you whiles and do whiles later.....

int i=0;

for(i=0;i<10;i++)
/*this starts the loop, there are 3 sections here the first one "(i=0)" sets your variable, here it's redundunt because i did it above but oh well (you could also do int i=0 here); section 2: "i<10;" this is the statement that says how long you want the loop to run for, in this case i want it to run "while i is less than 10" you can also do <= (less than or equal to), ==, >, or >=.; the 3rd section "i++), this says that at the END of every run of the loop you want i to equal what it was is at the end plus one. Because this is at the end of the loop that it is added that means that in this case my loop will actually run 10 times once while i==0, i==1, i==2...and at i==9. It checks the while statement at the begining of each run. */
{

cout << "I've run " << i << " times" << endl;
}

and that's a real simple for loop.

8. ## do while loop

However what you really want for this is probably a do while loop....

What it does is it automatically runs atleast 1 time no matter what (because of the do) and then till a paramater is met.

so for example:

int k=0;

do
{

cout << "hi bob" << endl;
k++; //have to put this in here cause its not built in like on the for
}
while(k<10); //this one also checks to make sure you're in paramaters at the end instead or the begining.

Try using that for your program...I'm afk for a while now but if you need help still drop me a line and I'll reply later

9. Originally posted by kermi3
yup....here we go....don't have time to do all three kinds of loops so I'm just gonna do a for loop for now....I'll show you whiles and do whiles later.....

int i=0;

for(i=0;i<10;i++)
/*this starts the loop, there are 3 sections here the first one "(i=0)" sets your variable, here it's redundunt because i did it above but oh well (you could also do int i=0 here); section 2: "i<10;" this is the statement that says how long you want the loop to run for, in this case i want it to run "while i is less than 10" you can also do <= (less than or equal to), ==, >, or >=.; the 3rd section "i++), this says that at the END of every run of the loop you want i to equal what it was is at the end plus one. Because this is at the end of the loop that it is added that means that in this case my loop will actually run 10 times once while i==0, i==1, i==2...and at i==9. It checks the while statement at the begining of each run. */
{

cout << "I've run " << i << " times" << endl;
}

and that's a real simple for loop.

hmm ok i think im gettin a grasp of it. The main focus of the loop is so at the end of the program theres an option restart the program without closing it...and then if thats wut the user would want to do..it would clear the screen and then start the program all over again. so i get basicly how that loop would work...but how would i put together the loop im looking for? heres the code for my program...

/* DAVES FIRST PROGRAM */
///////// david4050@hotmail.com ///////////////

#include <iostream.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
int main()
{

int x;
int y;
int z;
char entry;
char entry1;
char GoOn;
char Begin;

cout <<"////////////// EZY Math Calculator ///////////////"<<endl;
cout <<" david4050@hotmail.com\n\n";
cout <<"Hey! Welcome to EZY Math Calculator."<< endl;
cout <<"Enter a number and press Enter.."<< endl;

cin >> x;

cout <<"The number you just entered was, " << x << endl;

cout <<"Please Enter another number and press Enter..."<< endl;

cin >> y;

cout <<"Do you want the Program do devide your numbers, multiply, add or subtract?\n\n";
cout <<" Press M and Enter for multiply\n\n";
cout <<" Press D and Enter for Divide\n\n";
cout <<" Press S and Enter for Subtraction\n\n";
cout <<" Press A and Enter for Addition\n\n";
cin >> entry;

switch(entry)
{
case 'm':
case 'M':
z = x*y;
cout<<""<<x;
cout<<" multiplied by "<<y;
cout<<",equals "<<z <<endl;
system("PAUSE");

break;

case 'D':
case 'd':
z = x/y;
cout<<" "<<x;
cout<<" divided by "<<y;
cout<<",equals "<<z <<endl;
system("PAUSE");
break;

case 'S':
case 's':
z = x-y;
cout<<" "<<x;
cout<<" subtracted by "<<y;
cout<<",equals "<<z <<endl;
system("PAUSE");
break;

case 'A':
case 'a':
z = x+y;
cout<<" "<<x;
cout<<",equals "<<z <<endl;
cout<<"Press Q to Exit otherwise Enter to continue.."<<endl;
cin>>entry1;
if (entry1 = ' ')
{
Begin;
}
else
{
system("PAUSE");
}

break;

default:
{
cout<<"Sorry, You've entered an invalid character. Please retry!"<<endl;
}

}

return 0;

}

10. dont mind the stuff about:

if (entry1 = ' ')
{
Begin;
}
else
{
system("PAUSE");
}

i wuz trying to play around with wierdo loops earlier

11. ok try this....didn't want to give it all to you but...here's a big hint hehe....

int stop=0;
do
{

switch(entry)
{
case 'Q':
case 'q':
{
stop=1;
break;
}
}

}
while(stop==0)

2 questions for you about the prgram...

What's the system("PAUSE") for?

and Are you using /n to go to the next line in your cout's? If so this works but you're better off using endl instead.

12. K i attached the exe version so u can see wut it looks like. the /ns i think i forgot to take out from yesterday when i thought they were vital to the program.....hey...i didnt know wut cout meant yesterday lol...and as for the system("PAUSE") ...so the program duznt close on me .......hmm..ill try that looping stuff and post a reply shortly

13. looks good...though you might want to put a getch(); at the end of it...now get that loop setup and you'll be all set.

14. K done...thanks for ur help on this i got a good grasp of it now..the only two problems are..now in the second thing after it loops it....if i accidentilly enter a letter instead of a number when it asks for it......BIG mess.....but its hillarious if u look at it...and wut do i put to clear the screen? i looked at the FAQ and did the clrscr() thing but it comes up as this linking error thing. i have #include <conio.h> in there aswell..i dont know wuts wrong

15. ok first of all include this:

#include <STDLIB.H>

that should take care of clrscr();

second of all are you using a char or an int for your input?

and finally make sure you have a getch() at the endof your program...if you do I don't think you'll need those syster("PAUSE")'s.