Ok. So I got interested in writing C++ after I saw a thread here. I have wanted to know how to program for a while, jus never taken the time to learn it. My programming is still VERY basic, but I would like someone to overlook it and tell me what Im doing wrong. I want it to first not end the program until you press enter. Also, It writes a new text document wether the answer is true or false. Please help me out..
Thanks to anyone who wouldnt mind taking a look.
mstandlee
Code:
#include <iostream>
#include <stdio.h> //needed for the fopen command. Writes the txt file
using namespace std;
int main()
{
int yesorno;
cout<<"Would you like to create the file NEWTXTFILE?: "; //this is the test line
cin>> yesorno;
cin.ignore();
if (yesorno = true)
{
fopen ("newtxtfile.txt", "w+");
cout<<"The file has been written\n"; //successfully writes a new text file
cout<<"This program will now close... Press enter to terminate Program.\n";
cin.get();
}
else if (yesorno = false)
{
cout<<"The file has not been written and this program will now close\n";
cout<<"Press enter to terminate Program.\n";
cin.get();
}
}
mstandlee