I am getting a syntax error on line where my if statement is because of the semicolon I place at the end..

#include<iostream>
#include <string>

using namespace std;

int main() {
//setting up numeral input
double loan_Payment;
double insurance;
double gas;
double oil;
double tires;
double maintenance;
double grand_Total;
grand_Total = (loan_Payment + insurance + gas + oil + tires + maintenance);


//setting up text input
std::cout.width(30); std::cout << std::left << "Loan Payment";

std::cin.width(15); std::cin >> std::right >> loan_Payment ;

std::cout.width(30); std::cout << std::left << "Insurance";

std::cin.width(15); std::cin >> std::right >> insurance;

std::cout.width(30); std::cout << std::left << "Gas" ;

std::cin.width(15); std::cin >> std::right >> gas;

std::cout.width(30); std::cout << std::left << "Oil";

std::cin.width(15); std::cin >> std::right >> oil;

std::cout.width(30); std::cout << std::left << "Tires";

std::cin.width(15); std::cin >> std::right >> tires;

std::cout.width(30); std::cout << std::left << "Maintenance";

std::cin.width(15); std::cin >> std::right >> maintenance;


std::cout.width(30); std::cout << std::left << "Total";

std::cin.width(15); std::cout << std::right << loan_Payment + insurance + gas + oil + tires + maintenance << endl;

std::cout.width(30); std::cout << std::left <<"Yearly Total";

std::cin.width(15); std::cout << std::right << 12 * (loan_Payment + insurance + gas + oil + tires + maintenance) << endl;

std::cout.width(30); std::cout << std::left << " 10%";

std::cin.width(15); std::cout << std::right << .10 * (loan_Payment + insurance + gas + oil + tires + maintenance) << endl;
//If the yearly total is greater than 1000 dollars, add 10 percent of the yearly total to the yearly total.
if (grand_Total > 1000) {
cout << ((12 * (loan_Payment + insurance + gas + oil + tires + maintenance) *(.10)) * (12 * (loan_Payment + insurance + gas + oil + tires + maintenance) ;
}
Last edited on
There are improperly-nested parens on the second-to-last line.
Those kind of errors can be detected quickly after practicing a lot and it's very important. If your'e getting troubles detecting those errors you can try using a program as help. I tend to use checkmarx these days and it does a good job.
Anyway, good luck with that.
Ben.
@benhart,
if the tool you advertise is so great why don't you show use how it could solve this particular problem?
I suspect that you just want to advertise but are not really interested to help the OP to solve his problem.
Topic archived. No new replies allowed.