Hey folks, this is my first program and i dont know what to do to make it output my imput to a .txt file, can anybody tell me or show me what im doing wrong. thanks.
/*MuTech Computers Address Book by Michael Grayson.*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
cout << "Welcome To The MuTech Address Book.\nHere You Can Store All Your Friends Infomation.";
cout << "\n\nPlease Imput The Relevant Infomation";
ofstream address;
address.open ("Address'.txt");
string name;
string home;
string mobile;
string address0;
string postcode;
string email;
string notes;
cout << "Contacts Name: ";
getline (cin, name);
cout << "\nContacts Home Phone Number: ";
getline (cin, home);
cout << "\nContacts Mobile Phone Number: ";
getline (cin, mobile);
cout << "\nContacts House Address: ";
getline (cin, address0);
cout << "\nContacts Postcode: ";
getline (cin, postcode);
cout << "\nContacts Email: ";
getline (cin, email);
cout << "\nNotes: ";
getline (cin, notes);
ofstream myfile ("Addressbook.txt");
if (myfile.is_open()){
myfile.write << name << "\n" << home << "\n" << mobile << "\n" << adress0;
myfile.write << "\n" << postcode << "\n" << email << "\n" << notes;
myfile.close();
{
else
cout << "Unable to open file";
return 0;
}