ok, i am making a database -- here is the code, i marked what the compiler is angry about...
ok, the first error reads "expected primary expression before 'else'" and the second error for the same line says "expected `;' before 'else'"Code:#include <iostream> #include <stdlib.h> #include <cstring> #include <fstream> #include <windows.h> #include <time.h> using namespace std; int main() { system("cls"); cout << " Please Enter Your Information." << endl; cout << endl; char string0[256]; cout << " Please Enter Your Name: "; cin.getline ( string0, 256, '\n' ); char string[256]; cout << " Please Enter Your Address: "; cin.getline ( string, 256, '\n' ); char string1[256]; cout << " Please Enter Your 2nd Address (Optional): "; cin.getline ( string1, 256, '\n' ); char string2[256]; cout << " Please Enter Your City: "; cin.getline ( string2, 256, '\n' ); char string3[3]; cout << " Please Enter Your State (XX): "; cin.getline ( string3, 3, '\n' ); char string4[10]; cout << " Please Enter Your Zipcode: "; cin.getline ( string4, 10, '\n' ); char string5[256]; cout << " Please Enter Your Phone Number: "; cin.getline ( string5, 256, '\n' ); cout << endl; cout << endl; cout << endl; cout << " Is This Information Correct?" << endl; cout << endl; cout << " Name: " << string0 << endl; cout << " Address: " << string << endl; cout << " Address(2): " << string1 << endl; cout << " City: " << string2 << endl; cout << " State: " << string3 << endl; cout << " Zip: " << string4 << endl; cout << " Phone: " << string5 << endl; cout << endl; char sure[2]; cout << " Is This Information Correct? (Y/N): "; cin.getline ( sure, 2, '\n' ); if ( strcmp ( sure, "Y" ) == 0 ) system("cls"); cout << " Great! Your Information Has Been Recorded!" << endl; ofstream a_file ( "information.txt", ios::app ); a_file << string0 << string << string1 << string2 << string3 << string4 << string5; a_file.close(); Sleep(5000); system("exit"); else system("cls"); cout << " This Is Your Last Chance!" << endl; char string7[256]; cout << " Please Enter Your Name: "; cin.getline ( string7, 256, '\n' ); char string8[256]; cout << " Please Enter Your Address: "; cin.getline ( string8, 256, '\n' ); char string9[256]; cout << " Please Enter Your 2nd Address (Optional): "; cin.getline ( string9, 256, '\n' ); char string10[256]; cout << " Please Enter Your City: "; cin.getline ( string10, 256, '\n' ); char string11[3]; cout << " Please Enter Your State (XX): "; cin.getline ( string11, 3, '\n' ); char string12[10]; cout << " Please Enter Your Zipcode: "; cin.getline ( string12, 10, '\n' ); char string13[256]; cout << " Please Enter Your Phone Number: "; cin.getline ( string13, 256, '\n' ); system("cls"); cout << " Your Information Has Been Recorded!" << endl; ofstream b_file ( "information.txt", ios::app ); b_file << string7 << string8 << string9 << string10 << string10 << string11 << string12 << string13; b_file.close(); cin.get(); }
the tutorial i went off of is this:
HOW IS THAT DIFFERENT?Code:if ( strcmp ( name, "Julienne" ) == 0 ) cout<<"That's my name too.\n"; else cout<<"That's not my name.\n";



LinkBack URL
About LinkBacks


