program execute but output negative answer

#include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;

int main ()
{

ifstream inFile;
ofstream outFile;

int sa, tk, sa1, tk1, sa2, tk2, sa3, tk3;

double totalTicket;
double totalSales;

inFile.open ("stadttik");
outFile.open ("stadtot");

outFile << fixed << showpoint;
outFile << setprecision(2);

cout << " File in process..." <<endl;

inFile >> tk >> tk1 >> tk2 >> tk3;

totalTicket = tk + tk1 + tk2 + tk3;
outFile << "Total ticket sold at the game = " << totalTicket <<endl <<endl;

inFile >> sa >> sa1 >> sa2 >> sa3;

totalSales = sa + sa1 + sa2 + sa3;
outFile << "Total sales amount = $" << totalSales <<endl;

inFile.close();
outFile.close();

return 0;

}
And we're supposed to work that out without seeing the values? Have you tried debugging you program?
Topic archived. No new replies allowed.