Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

C++ Help


ghost's Avatar
0 0

hey why isnt this working? its striaight out of a tutorial on cprogramming.com


using namespace std;

int main()
{
    int anumber();
    
    cout<<"Please enter a number: ";
    cin>> anumber;
    cin.ignore();
    cout<<"You entered: " << number << "\n";
    cin.get();
}```
ya im using Bloodshed and the error i get is line 10 where it says:
'cin>> anumber;' what is wrong with that please? the error message is:
ambiguous overload for 'operator>>' in 'std::cin >> anumber' 
sorry if its a dumb mistake but im new, thanks
end3r

ghost's Avatar
0 0

im new to C++ as well and using bloodshed myself, butttt….

i think its the int anumber() ;

part… there should be no () when declaring an integer..

i think… let me know


ghost's Avatar
0 0

yeah what he said, and:```markup#include <iostream>

using namespace std;

int main() { int anumber();

cout<<"Please enter a number: "; cin>> anumber; cin.ignore(); cout<<"You entered: "; cout<< number << endl; cin.get(); return(0); }``` that should work fine


ghost's Avatar
0 0

ok thanks i got it end3r