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: David M. <dav...@ei...> - 2000-12-10 22:42:31
|
#include <iostream.h>
int main (void)
{
char John [5];
=20
cout << "please enter your name.." <<endl;
cin>>John;
if (John =3D=3D "John")
cout << "Thank you";
else=20
cout << "Nope";
=20
}
----- Original Message -----=20
From: J R=20
To: dev...@li...=20
Sent: Sunday, December 10, 2000 10:16 PM
Subject: Re: [Dev-C++] I am new to C ++ and need some help
Nope that still isnt working any other suggestions anyone??
Thanks,
J
=20
Matthew FitzGerald <fit...@ho...> wrote:=20
Try this:
include <iostream.h>
int main (void)
{
char John [5];
=20
cout << "please enter your name.." <<endl;
cin>>John;
if (John =3D=3D "John")
{
cout << "Thank you";
}
else (John !=3D "John")
{
cout << "Nope";
}
}
----- Original Message -----=20
From: J R=20
To: dev...@li...=20
Sent: Sunday, December 10, 2000 10:50 AM
Subject: [Dev-C++] I am new to C ++ and need some help
Now I'm sure to all you long time C++ ediotrs out there this =
question will be obvious but I just can't figure it out. here goes. I =
want a program that asks for your name and then I want it so if you =
enter John as your name it will say thanks and if you enter anything =
else it will say Nope I have tried and tried but to no avail. =
Here is what I have
#include <iostream.h>
#include <stdlib.h>
int main()
{
unsigned short int name,john;
cout << "Please enter your name: ";
cin >> name;
if (name=3Djohn)
cout << "\nThanks!\n";
else
cout << "\nNope!\n";
system("PAUSE");
return 0;
}
As of now it says thanks no matter what. I have tried and =
tried but nothing will work and I'm sure I did something stupid to make =
it not work. If you could rewrite what I did wrong or just write a =
brand new code it would be greatly appreciated.
Thanks,
J
-------------------------------------------------------------------------=
-
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
-------------------------------------------------------------------------=
-----
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
|