Hi all,
Ok, dumb question time. Take a look at the code below, (ignoring the crap layout, etc). The program itself works except for a few glitches.
1). I want the user to be able to press Q to quit the loop and get the results. This was working at the start but obviously I've screwed something up and now it doesn't.
2). I would like each of the results printed on a seperate line instead of a stream of text and results with no spaces
3). When coding, what symbol is used to enable me to run the text over to the next line without C++ thinking that its the next piece of the program?
4). Last one. At the moment this program is stuck in the loop, everytime I enter the age of the client I get the results(?)
As I said, these are very dumb questions & I'm certainly no programmer, this is for a compulsery course I'm doing.
Thanks for your time.
int main(int argc, char* argv[])
{
char claimed;
int claim;
int age;
int u25;
int returns;
claimed = '*';
claim =0;
u25 = 0;
returns = 0;
while (claimed != 'Q')
{
claimed = ReadCharPr("Has the client claimed within the last 12 months? "
age = ReadIntPr("Age of client: "
if (claimed != 'Q')
{
returns = returns + 1;
}
if (age < 25)
{
u25=u25 +1;
}
if (claimed == 'Y')
{
claim = claim + 1;
}
WriteIntPr("Number of results analysed = ", returns);
WriteIntPr("Number of claimants = ", claim);
WriteIntPr("Number of claimants under 25 = ", u25);
}
getchar();
return 0;
}
Ok, dumb question time. Take a look at the code below, (ignoring the crap layout, etc). The program itself works except for a few glitches.
1). I want the user to be able to press Q to quit the loop and get the results. This was working at the start but obviously I've screwed something up and now it doesn't.
2). I would like each of the results printed on a seperate line instead of a stream of text and results with no spaces
3). When coding, what symbol is used to enable me to run the text over to the next line without C++ thinking that its the next piece of the program?
4). Last one. At the moment this program is stuck in the loop, everytime I enter the age of the client I get the results(?)
As I said, these are very dumb questions & I'm certainly no programmer, this is for a compulsery course I'm doing.
Thanks for your time.
int main(int argc, char* argv[])
{
char claimed;
int claim;
int age;
int u25;
int returns;
claimed = '*';
claim =0;
u25 = 0;
returns = 0;
while (claimed != 'Q')
{
claimed = ReadCharPr("Has the client claimed within the last 12 months? "
age = ReadIntPr("Age of client: "
if (claimed != 'Q')
{
returns = returns + 1;
}
if (age < 25)
{
u25=u25 +1;
}
if (claimed == 'Y')
{
claim = claim + 1;
}
WriteIntPr("Number of results analysed = ", returns);
WriteIntPr("Number of claimants = ", claim);
WriteIntPr("Number of claimants under 25 = ", u25);
}
getchar();
return 0;
}