I couldn't get in here for a while, my pc was clocking-busy place?!
I posted my problem to the wrong forum & didn't get any help-surprise!
I just want to know what I'm doing wrong in my code. I can't get rid of the 2 errors or understand what they mean. I'm a beginner. thx for any help!
//addrfile.cpp
#include <iostream.h>
#include "apstring.h"
#include <fstream.h>
int main()
{
apstring user_name;
int street_num;
apstring street_name;
apstring apt_num;
apstring city;
apstring state;
int zip;
ofstream outfile;
ifstream infile;
outfile.open("ADDR.DAT", ios::out);
cout <<"Enter your name: ";
getline(cin, user_name);
cout << "Enter your street number: ";
cin >> street_num;
cout << "Enter your street name: ";
getline(cin, street_name);
cout << "Enter your apartment or hit enter if none: ";
cin >> apt_num;
cout << "Enter your City: ";
getline(cin, city);
cout << "Enter your 2 digit state code: ";
getline(cin, state);
cout << "Enter your zip code: ";
cin >> zip;
{
outfile << "Name: " << user_name << endl;
outfile << "Address: " << street_num, street_name << endl;
outfile << apt_num << endl;
outfile << city, state, zip << endl;
}
outfile.close();
return 0;
}
--------------------Configuration: addrfile - Win32 Debug--------------------
Compiling...
addrfile.cpp
C:\C++ Files\Chapter 08\addrfile.cpp(39) : error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class apstring' (or there is no acceptable conversion)
C:\C++ Files\Chapter 08\addrfile.cpp(41) : error C2297: '<<' : illegal, right operand has type 'class ostream &(__cdecl *)(class ostream &)'
Error executing cl.exe.
addrfile.obj - 2 error(s), 0 warning(s)