The error i get is:
'user:input' undeclared[first use this function]

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

int main()
{
     // declaring variables \\
       string user_input;
    // end of declaring variables \\
    
cout
<<"Hello and welcome to Mr. Nightwish's lab of crazy!"
<<endl
<<endl
<<"Please choose one of the following options:"
<<endl
<<"1. Addition"
<<endl
<<"2. Subtraction"
<<endl
<<"3. Exit"
<<endl;
    cin >> user_input;
    while(user_input!=1 && user_input!=2 && user_input!=3)
    {
                        cout <<"Please enter an integer between 1 and 3";
                        cin >> user_input;
    }
cin.get();
return 0;

}

you might have to #include<string>

Still didn't work ;/
When i put "string user_input;" JUST BEFORE cin>>user_input it will work
;//

>> When i put "string user_input;" JUST BEFORE cin>>user_input it will work

Line 8 is effectively a comment because you end line 7 with a backslash (it's called line continuation). So, delete the unwanted backslashes ..

#include <string>
int main()
{
  // declaring variables
  string user_input;

>> When i put "string user_input;" JUST BEFORE cin>>user_input it will work

Line 8 is effectively a comment because you end line 7 with a backslash (it's called line continuation). So, delete the unwanted backslashes ..

#include <string>
int main()
{
  // declaring variables
  string user_input;

Thanks,
but now another problem occured ;/

Line 25
no match for 'operaror!=' in 'user_input!=1'

Isn't there a IS NOT equal to?
I thought it was != ?

>> no match for 'operaror!=' in 'user_input!=1'

If you want to retain user_input as std::string , then compare against appropriate string literals, e.g.

if(user_input == "1")
{
  // Option no. 1 selected
}

Edited 6 Years Ago by mitrmkar: typo

This question has already been answered. Start a new discussion instead.