doesn't work here and I don't know what else I could use...
Code:
Error 1 error C2059: syntax error*: '{' c:\documents and settings\test\bureau\hacklearning\selftalker\selftalker\selftalker.cpp 55 SelfTalker
Error 2 error C2143: syntax error*: missing ';' before '{' c:\documents and settings\test\bureau\hacklearning\selftalker\selftalker\selftalker.cpp 55 SelfTalker
Error3 error C2143: erreur de syntaxe*: missing ';' before '}' c:\documents and settings\test\bureau\hacklearning\selftalker\selftalker\selftalker.cpp 55 SelfTalker
Well lets look at the errors, shall we.
syntax error*: '{' something to do with one of your '{'s
syntax error*: missing ';' before '{' missing a ';' before a '{'
syntax error*: missing ';' before '}' missing a ';' before a '}'
obviously, your missing ';'s before '{''}'s *not supposed to be a kirby but it kinda is*
lets look at your code for areas that have '{' or '}' without a ';' before them. and something to do with a misplaced '}'...
well, heres our code at the start
[php]#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
/////////////////////////////////////
int age = 0;
char name[] = "default";
char wdylif[] = "default";
char yes[] = "yes";
char no[] = "no";
char yesorno[] = "yesorno";
/////////////////////////////////////
cout << "Hi, was is your name?" << endl;
cin >> name;
cout << "Fine " << name << ", my name is Naghal." << endl;
cout << "I am 15 years old and you?" << endl;
cin >> age;
cout << "Ok, what do you like in life?" << endl;
cin >> wdylif;
cout << "Amazing, I love to do that too!" << endl;
cout << "Omg, do you want to be my friend?" << endl;
cin >> yesorno;
if ( !strcmp(yesorno,"yes") )
{
cout << "Cool ur ma new best friendz!" << endl;
}
else if ( !strcmp(yesorno,"no") )
{
cout << "Aw comon pleaseee!!!" << endl;
}
else
{
cout << "Please, answer by yes or no." << endl;
}
do{if ( !strcmp(yesorno,"yes") )
{
cout << "Cool ur ma new best friendz!" << endl;
}
else if ( !strcmp(yesorno,"no") )
{
cout << "Aw comon pleaseee!!!" << endl;
}
else
{
cout << "Please, answer by yes or no." << endl;
}}
while {!strcmp(yesorno,"yes") || !strcmp(yesorno,"no")}
system("pause"); //Let time of the player to read last answer
return 0;
}
[/php]
half of this doesn't include '{'s
[php]
if ( !strcmp(yesorno,"yes") )
{
cout << "Cool ur ma new best friendz!" << endl;
}
else if ( !strcmp(yesorno,"no") )
{
cout << "Aw comon pleaseee!!!" << endl;
}
else
{
cout << "Please, answer by yes or no." << endl;
}
do{if ( !strcmp(yesorno,"yes") )
{
cout << "Cool ur ma new best friendz!" << endl;
}
else if ( !strcmp(yesorno,"no") )
{
cout << "Aw comon pleaseee!!!" << endl;
}
else
{
cout << "Please, answer by yes or no." << endl;
}}
while {!strcmp(yesorno,"yes") || !strcmp(yesorno,"no")}
system("pause"); //Let time of the player to read last answer
return 0;
}
[/php]
you just added a loop, your first one. Let's check and make sure those are coded right. hmm NOPE! found the first error.
The correct syntax is do{}while(); you have do{while()}
lets quickly fix that
[php]#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
/////////////////////////////////////
int age = 0;
char name[] = "default";
char wdylif[] = "default";
char yes[] = "yes";
char no[] = "no";
char yesorno[] = "yesorno";
/////////////////////////////////////
cout << "Hi, was is your name?" << endl;
cin >> name;
cout << "Fine " << name << ", my name is Naghal." << endl;
cout << "I am 15 years old and you?" << endl;
cin >> age;
cout << "Ok, what do you like in life?" << endl;
cin >> wdylif;
cout << "Amazing, I love to do that too!" << endl;
cout << "Omg, do you want to be my friend?" << endl;
cin >> yesorno;
if ( !strcmp(yesorno,"yes") )
{
cout << "Cool ur ma new best friendz!" << endl;
}
else if ( !strcmp(yesorno,"no") )
{
cout << "Aw comon pleaseee!!!" << endl;
}
else
{
cout << "Please, answer by yes or no." << endl;
}
do{if ( !strcmp(yesorno,"yes") )
{
cout << "Cool ur ma new best friendz!" << endl;
}
else if ( !strcmp(yesorno,"no") )
{
cout << "Aw comon pleaseee!!!" << endl;
}
else
{
cout << "Please, answer by yes or no." << endl;
}}
}while {!strcmp(yesorno,"yes") || !strcmp(yesorno,"no")
system("pause"); //Let time of the player to read last answer
return 0;
}
[/php]
by running this, the second two errors are still found. Well, using my handy dandy visual c++ ultimate edition, the errors are pointed out to me. You haev while { )... uhoh! and then, VS c++ points out that near the middle, you have an extra '}' seeing as it's extra, it ends the do loop... OH NOES. Well, now both those errors are fixed, this is what we get
[php]
#include <iostream>
using namespace std;
int main()
{
/////////////////////////////////////
int age = 0;
char name[] = "default";
char wdylif[] = "default";
char yes[] = "yes";
char no[] = "no";
char yesorno[] = "yesorno";
/////////////////////////////////////
cout << "Hi, was is your name?" << endl;
cin >> name;
cout << "Fine " << name << ", my name is Naghal." << endl;
cout << "I am 15 years old and you?" << endl;
cin >> age;
cout << "Ok, what do you like in life?" << endl;
cin >> wdylif;
cout << "Amazing, I love to do that too!" << endl;
cout << "Omg, do you want to be my friend?" << endl;
cin >> yesorno;
if ( !strcmp(yesorno,"yes") )
{
cout << "Cool ur ma new best friendz!" << endl;
}
else if ( !strcmp(yesorno,"no") )
{
cout << "Aw comon pleaseee!!!" << endl;
}
else
{
cout << "Please, answer by yes or no." << endl;
}
do{
if ( !strcmp(yesorno,"yes") )
{
cout << "Cool ur ma new best friendz!" << endl;
}
else if ( !strcmp(yesorno,"no") )
{
cout << "Aw comon pleaseee!!!" << endl;
}
else
{
cout << "Please, answer by yes or no." << endl;
}
}while (!strcmp(yesorno,"yes") || !strcmp(yesorno,"no");
system("pause"); //Let time of the player to read last answer
return 0;
} [/php]
Hmm... still get an error, lets check out that while loop again. Double check then triple check right? You're missing a ')' at the end of that.... that just can't be, this is c++ after all. Lets fix that, andddd