codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  C++ beginner question  Porkypig at 16:39 on Wednesday, August 09, 2006
 


Hey, I'm teaching myself how to use C++ before I start my term of it in January.
This is my second code I've completed and I have one problem that I can't figure out... I know it's going to be an easy answer for the majority of you guys to figure out, so any help would be appreciated.
Thanks.
--------------------------------------------------

#include <iostream>
using namespace std;

int main()
{

int d, remainder;
char answer;

part1:

cout << "Please Enter a number to determine if the number is even or odd: ";
cin >> d;
cout << "Are you sure about this number???";
cout << " (y or n) " ;
cin >> answer;



if (answer = y)
{
cout << "Thank you" << endl;
system ("pause");
goto part2;
}

if (answer = n)
{
cout << "Lets try this again" << endl;
system ("pause");
goto part1;
}

else
cout << "Error" << endl << "Please Try again" << endl;
system ("pause");
goto part1;

part2:

remainder = d%2;


if (d%2==0)
{
cout << "The number is even";
cout << "\n";

}
else
{
cout << "The number is odd";
cout << "\n";
}

system ("pause");
return 0;
}
--------------------------------------








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime
•  help me
•  pls help me with this..
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem
•  Re: import contacts of msn/yahoo


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007