questions

i am trying to get this code to work so i can ask questions.

#include <iostream>

using namespace std;

int main ()
{
char name[50];
char answer;

cout << "hello what is your name\n";
cin >> name;
cout << "nice to meet you " << name << endl;

cout << "how was your day\n";

// check the boolean condition
if( name[50] = 3 )
{
cout << "thats good to know";
}

else
{
cout << "thats not good";
}
system("pause>nul");
}
sorry it lost its formating
Wish I could help you but I think your missing a few things:

#include <iostream>

using namespace std;

int main ()
{
char name[50];
char answer;

cout << "hello what is your name\n";
cin >> name; /* this wont work because name is an array */
cout << "nice to meet you " << name << endl;

cout << "how was your day\n";

/* check the boolean condition <-- this is a boolean condition its not checking a boolean condition */
if( name[50] = 3 ) /* this would have to be if(name[50] =='3') and that would be checking if the 50th character of the array is 3 */ then it would perform the following task
{
cout << "thats good to know";
}

else
{
cout << "thats not good";
}
system("pause>nul"); /* this is suppose to be system("PAUSE"); not system("pasue>null"); */
}
I hope I helped you out a little and it seems like not many people like system("PAUSE"); so I'm no promoting it.
Last edited on
Topic archived. No new replies allowed.