Beginner error expected ;

So I'm new to C++ and I don't completely get the syntax and I'm getting some errorx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
using namespace std;

class Car{
public:
       void setMake(string a) {make = a;}
       void setModel(string o) {model = o;}
       void setYear(unsigned y) {year = y;}
       void setPrice(unsigned p) {price = p;}
       string getMake() const {return make;}
       string getModel() const {return model;}
       unsigned getYear() const {return year;}
       unsigned getPrice() const {return price;}
       void compare(const Car& b) const {
               if(price > b.price) cout << model "is a better deal" << endl;        //  This line has an error.
                       else
               cout << b.model "is a better deal" << endl;                               //  This line has an error.
               }
private:
       string make;
       string model;
       unsigned year;
       unsigned price;
       };

int main(){

Car c;
Car d;

c.setMake("Ford");
c.setModel("Escort");
c.setYear(1995);
c.setPrice(6000);

d.setMake("Chevy");
d.setModel("S-10");
d.setYear(1993);
d.setPrice(3000);

cout << c.getMake() << endl;
cout << c.getModel() << endl;
cout << c.getYear() << endl;
cout << c.getPrice() << endl;

c.compare(d);

}


Here are the errors

1
2
3
4
31.cpp: In member function `void Car::compare(const Car&) const':
31.cpp:15: error: expected `;' before string constant
31.cpp:17: error: expected `;' before string constant
 
cout << model "is a better deal"
should be
cout << model << "is a better deal"
there is an beginners section:P...
Thanks guys, sorry I overlooked the beginner section, I was in a bind
Topic archived. No new replies allowed.