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: J R <ray...@ya...> - 2000-12-10 22:16:15
|
Nope that still isnt working any other suggestions anyone??
Thanks,
J
Matthew FitzGerald <fit...@ho...> wrote:
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";
}
}
----- Original Message -----
From: J R
To: dev...@li...
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=john)
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. |