RE: [Dev-C++] I am new to C ++ and need some help
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ya...> - 2000-12-11 00:09:30
|
A better and working version in C++ of this, is the following:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string John;
cout << "Please enter your name.." <<endl;
cin>>John;
if (John == "John")
cout << "Thank you";
else
cout << "Nope";
return 0;
}
A corrected version of the original posting, so as to work is:
#include <iostream>
using namespace std;
int main ()
{
char John [5];
cout << "please enter your name.." <<endl;
cin>>John;
if (John == "John")
cout << "Thank you";
else
cout << "Nope";
}
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Matthew
FitzGerald
Sent: Sunday, December 10, 2000 9:47 PM
To: dev...@li...
Subject: Re: [Dev-C++] I am new to C ++ and need some help
Try this:
include <iostream.h>
int main (void)
{
char John [5];
cout << "please enter your name.." <<endl;
cin>>John;
if (John == "John")
{
cout << "Thank you";
}
else (John != "John")
{
cout << "Nope";
}
}
|