Hi, I am working on a program that is to do the following: display a menu with 3 options 1) create a geometric sequence, 2) create an arithmetic sequence, and 3) Quit. For both sequences the program has to ask the user for two numbers within a specific range that will be used to construct the sequence. If the number is not within the range the program has to display an error message and then return back to the menu. If the numbers are within the correct range then the sequence must be displayed for every term that is less than 1000. I am only as far as the geometric sequence. When compiling in code::blocks I get the error: "invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'|"
#include <iostream>
usingnamespace std;
// Define variables before doing anything else.
int choice;
int geo;
int multiplier;
int geo_Sequence;
int main()
{
choice = 0;
while (choice != 3)
{
//Menu
cout << "1 - Create a geometric sequence" << endl;
cout << "2 - Create an arithmetic sequence" << endl;
cout << "3 - Quit" << endl;
cout << endl;
cout << "Please select an option: ";
cin >> choice;
cout << endl;
switch (choice)
{
case 1:
//I am choosing to make the first term between 1 and 100 and the multiplier between 1 and 10.
//This is to ensure that the worst case scenario is that only two terms are displayed
//(Since 100 * 10 = 1000, making the sequence be 100, 1000)
cout << "Please enter a number between 1 and 100: ";
cin >> geo;
cout << endl;
if (geo < 1)
{
cout << "The number you have entered is too small, please try again." << endl << endl;
}
elseif (geo > 100)
{
cout << "The number you have entered is too large, please try again." << endl << endl;
}
else
{
cout << "Now enter a number between 1 and 10: ";
cin >> multiplier;
cout << endl;
if (multiplier < 2)
{
cout << "The number you have entered is too small, please try again." << endl << endl;
}
elseif (multiplier > 10)
{
cout << "The number you have entered is too large, please try again." << endl << endl;
}
else
{
geo_Sequence = multiplier * geo;
while(geo_Sequence < 1000)
{
cout << geo_Sequence *= multiplier << endl << endl;
}
}
}
case 2:
case 3:
break;
default:
;
}
}
return 0;
}
I am wondering what can be causing this error. When searching online I have found alot of cases where it was due to syntax errors, but I can't seem to find any. Any help would be greatly appreciated.