sorry about all of the dumb errors, guys but this code was written up pretty fast and wasn't given much thought so I decided to fix everything up except I can't fix this (crazy) error that I keep getting.
My new code:
Code:
#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
class person
{
public:
person()
{
number = 0;
}
~person()
{
}
char fName[40];
char lName[40];
int number;
};
person p;
int i = 1;
int main()
{
for(;;)
{
int choice = 0;
person p;
cout << "Enter the person's first name: ";
cin >> p.fName;
cout "\nEnter the person's last name: ";
cin >> p.lName;
cout << "\nEnter the person's telephone number: ";
cin >> p.number;
ofstream file("data.txt", ios::ate);
file << "\nID = ";
file << i;
file << "\nName: ";
file << p.fName;
file << " ";
file << p.lName;
file << "\nTelephone Number: ";
file << p.number;
file << "-----------------------------------\n\n";
i++;
cout << "Data stored in data.txt...\n";
cout << "Enter another?(y or n) ";
cin >> choice;
if(choice == 'n')
{
break;
}
}
return 0;
}
And here is the error:
Code:
error C2143: syntax error : missing ';' before 'string'
My response to this error:
"...WHAT THE...??????"
The error happend on this line:
Code:
cout "\nEnter the person's last name: ";
I know, I haven't got the slightest clue either but has anybody go any ideas?