Hi there everyone. This is my first post so I hope I get all the ettiquette right.
I am just getting started learning C++ from books and am really enjoying it but running into some of the problems that I'm sure many people have. Sadly this one seems to elude me and I have looked as carefully as I can in my books and on websites. So my apologies if this is so obvious.
All I am trying to do is test the condition of a variable and the result of that test is used to determine which function to call. All I keep getting is a complie time error: expected primary-expression before '<' token.
This is just a little program to test out some of the things I've learnt so far
I'm not sure what I have done wrong as I am trying to follow the syntax in my reference books and tutorials so any help as to my errors would be greatly appreciated. Oh btw there is an error for every line where a conditional operator is used.Code:#include <iostream>using namespace std; int addition (int a, int b) { return a + b; } int mult (int a, int b) { return a * b; } int main () { int a, b, path; cout << "Enter a pathway interger (1-10)\n"; cin >> path; cout << "Enter the two variables needed for the program: "; cin >> a; cout << "\t"; cin >> b; if (path != 0 && < 5) { cout << addition(a,b); } if (path > 5 && < 11) { cout << mult(a,b); } if (path == 0 || >= 11) { cout << "you are a dumbass that can't follow instructions!"; } system("PAUSE"); return 0; }
Many thanks