I do not have a clue here. I am floundering along but not getting anywhere. Any suggestions would be greatly appreciated. Thank you.

/*This is a program that processes a loan for a car using appropriately named variables.
It will use those variables in the input, calculation, and output of this program. This
program works on a payment plan with zero interest and sales tax fixed at 6%. The car
in this program is driven 1000 miles per month.*/

#include <iostream>
#include <string>
using namespace std;

int main ()
{
	int number;
    string name;

	//Variable declarations
	string make, model, year,  answer;
	int year, mileage, costs, months, tax, answer;

	cout << "What is the make of the car?;
    getline (cin,Ford);
	cout << "What is the model of the car?";
	cin >> Bronco;
	cout << "What is the year of the car?";
	cin >> 2005;
	cout << "What is the mileage of the car?";
	cin >> 12345;
	cout << "What is the cost of the car?";
	cin >> 15000;
	cout << "How many months for the loan?";
	cin >> 36;
	cout << "What is the sales tax?";
	cin >> .06;
	cout << "What are the miles per month?";
	cin >> 1000;
	cout << "Your 2005 Ford Bronco costs;"$"; << cost << after sales_tax; << salestax << and will cost you;"$" per month; 
	cout << "for"; << "months.";"When it is paid off,; << you will probably have;<< miles on it."; << endl;
}

These are my beautiful errors but what it is asking for I think is corrected.

c:\users\carole\documents\visual studio 2008\projects\compsci-assign11\compsci-assign11\compsci-assign11.cpp(40) : error C2146: syntax error : missing ';' before identifier '$'
c:\users\carole\documents\visual studio 2008\projects\compsci-assign11\compsci-assign11\compsci-assign11.cpp(40) : error C2065: '$' : undeclared identifier
c:\users\carole\documents\visual studio 2008\projects\compsci-assign11\compsci-assign11\compsci-assign11.cpp(40) : error C2143: syntax error : missing ';' before 'string'
c:\users\carole\documents\visual studio 2008\projects\compsci-assign11\compsci-assign11\compsci-assign11.cpp(40) : error C2001: newline in constant
c:\users\carole\documents\visual studio 2008\projects\compsci-assign11\compsci-assign11\compsci-assign11.cpp(40) : error C2146: syntax error : missing ';' before identifier '$'
c:\users\carole\documents\visual studio 2008\projects\compsci-assign11\compsci-assign11\compsci-assign11.cpp(40) : error C2065: '$' : undeclared identifier
c:\users\carole\documents\visual studio 2008\projects\compsci-assign11\compsci-assign11\compsci-assign11.cpp(40) : error C2143: syntax error : missing ';' before 'string'
c:\users\carole\documents\visual studio 2008\projects\compsci-assign11\compsci-assign11\compsci-assign11.cpp(41) : error C2146: syntax error : missing ';' before identifier 'cout'
c:\users\carole\documents\visual studio 2008\projects\compsci-assign11\compsci-assign11\compsci-assign11.cpp(41) : error C2143: syntax error : missing ';' before '<<'
c:\users\carole\documents\visual studio 2008\projects\compsci-assign11\compsci-assign11\compsci-assign11.cpp(41) : error C2143: syntax error : missing ';' before '<<'

Recommended Answers

All 3 Replies

cin statements put input into the variables you declared. The actual values, Bronco, 2005, 12345, etc will be entered during runtime in response to the program's prompts.

In the cout statements u don't but ; before << operator. for example if u want to display a variable between text u write it this way:

cout << "Your 2005 Ford Bronco costs "<< cost << " $ after sales_tax";

in your cin statements, use your declared variables (ex. year, make, model) for what you want to be inputted. When you run the program, the type you enter for each question will be stored as each value (careful that you don't try to store 'Bronco' as an int value). When outputting after you have inputted your values, just use cout then the variable

Ex.)

//Program for adding two numbers
#include<iostream>
using namespace std;

int main()
{
    int one,two,sum;
    cout << "Enter number 1 : " << endl;
    cin >> one;
    cout << "Enter number 2 : " << endl;
    cin >> two;
    sum=one+two;
    cout << one << " + " << two << " = " << sum;

    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.