////main.cpp//Test////Created by Zzy on 2018/2/26.//Copyright 2018 Zzy. All rights reserved.//#include<iostream>#include<fstream>using namespacestd;intMain () {//Insert code here ... Charautomobile[ -]; intYear ; DoubleA_price,b_price; Ofstream OutFile; Outfile.open ("Carinfo.txt"); cout<<"Enter the make and model of Automabile:"; Cin.getline (automobile, -); cout<<"Enter the mobile year:"; CIN>>Year ; cout<<"Enter the oringinal asking price:"; CIN>>A_price; B_price=0.913*A_price; cout<<fixed; Cout.precision (2); COUT.SETF (Ios_base::showpoint); cout<<"Make and Mobile:"<<automobile<<Endl; cout<<"Year :"<<year<<Endl; cout<<"Was asking $"<<a_price<<Endl; cout<<"Now asking $"<<b_price<<Endl; OutFile<<fixed; Outfile.precision (2); OUTFILE.SETF (Ios_base::showpoint); OutFile<<"Make and Mobile:"<<automobile<<Endl; OutFile<<"Year :"<<year<<Endl; OutFile<<"Was asking $"<<a_price<<Endl; OutFile<<"Now asking $"<<b_price<<Endl; Outfile.close (); return 0; }
C + + file operations