Hi, i am writing a program that will ask the user for their shoe size and brand they would like to purchase and store it in a file. it was working but all of a sudden it stopped functioning properly. anything wrong you guys see? It's not writing to the file correctly.
#include<iostream>
#include<fstream>
usingnamespace std;
int main()
{
ofstream size_out("Shoe.out" , ios::app); //ios::app is for appending the file(write at the end of the file)
ofstream brand_out ("Shoe.out" , ios::app);
string size_shoe;
string brand;
cout<<"Enter the size:"<<endl;
cin>>size_shoe;
cout<<"Enter the brand:"<<endl;
cin>>brand;
size_out<<"size:"<<size_shoe<<endl;
brand_out<<"brand:"<<brand<<endl;
size_out.close();
brand_out.close();
return 0;
}
But if you want to make it with your code i will tell you what is the mistake(maybe not the only one).
Firstly you use only if, but you should know that when there's already an if statement you must use elseif
Secondly