D
deanfamily11
Ok, here's another problem I'm having. I've tried several different things,
but I just can't get anything to be right justified. Any thoughts?
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
//declare file stream variables
ofstream outData;
//declare variables
double value, taxAmt, propTax;
double tax = 0.92, rate = 1.05;
outData.setf(ios::right);
outData.setf(ios::left);
//open the output file
outData.open("c:\\review\\chapter 2\\exercise 4\\houseData.txt");
//get the assessed value
cout << "Enter the Assessed Value of the property: ";
cin >> value;
cout << endl;
//calculate values
taxAmt = value * tax;
propTax = (taxAmt / 100) * rate;
//begin outputting data
outData << "Assessed Value:";
outData << right;
outData << value << endl;
outData << left;
outData << "Taxable Amount:";
outData << right;
outData << taxAmt << endl;
outData << left;
outData <<"Tax Rate for each $100:";
outData << right;
outData << rate << endl;
outData << left;
outData <<"Property Tax:";
outData << right;
outData << propTax << endl;
//end the program
cout << "File created. Ending the program." << endl;
return 0;
}
but I just can't get anything to be right justified. Any thoughts?
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
//declare file stream variables
ofstream outData;
//declare variables
double value, taxAmt, propTax;
double tax = 0.92, rate = 1.05;
outData.setf(ios::right);
outData.setf(ios::left);
//open the output file
outData.open("c:\\review\\chapter 2\\exercise 4\\houseData.txt");
//get the assessed value
cout << "Enter the Assessed Value of the property: ";
cin >> value;
cout << endl;
//calculate values
taxAmt = value * tax;
propTax = (taxAmt / 100) * rate;
//begin outputting data
outData << "Assessed Value:";
outData << right;
outData << value << endl;
outData << left;
outData << "Taxable Amount:";
outData << right;
outData << taxAmt << endl;
outData << left;
outData <<"Tax Rate for each $100:";
outData << right;
outData << rate << endl;
outData << left;
outData <<"Property Tax:";
outData << right;
outData << propTax << endl;
//end the program
cout << "File created. Ending the program." << endl;
return 0;
}