Hi guys, I have to write a program that asks for the month year and total income for a month and it will find the sales rate with the equation s=7/1.06 i dont know how to save the input into a txt file. i dont know how to use the inFile command that well. The answre should turn out like this
bash-2.04$ a.out
Please enter the month for this report: February
Please enter the year for this report: 2005
Please enter the total income for this month: 15000.25
Sales Tax Report Saved to file: SalesTaxData.txt
bash-2.04$ cat SalesTaxData.txt
Month: February 2005
-----------------------
Total Collected: $ 15000.25
Sales: $ 14151.18
County Sales Tax: $ 283.02
State Sales Tax: $ 566.05
Total Sales Tax: $ 849.07
-----------------------
so far my code is like this but it does not work..
#include <iostream>
#include <fstream>
using namespace std;
cout << "Please enter the month for this report:";
cin>> month;
cout << "Please enter the year for this report:";
cin >> year;
cout << "Please enter the total income for this month:";
cin >> total;
cin >> total;
sales = total / 1.06;
cin >> sales;
cout << "The sales amount is "<< sales << endl;
ifstream shoud have
ifstream variable_name ("Name of file.extention all in quotes", open_mode);
ofstream should have
ofstream variable_name ("Name of file.extention all in quotes", open_mode);
This I find easier for myself to use\read then the .open stuff.
>> month; inFile << month; Whaaa? What are we trying to do?
The file input should all be done in a loop. So tear down and redo let's start freesh.