#Basic Newby C++ error (cin)

25 messages · Page 1 of 1 (latest)

sudden temple
#

#include <iostream>

int main(){
int x;
std::cout << "type a number: ";
cin << x;
std::cout << "Your number is; " << x;
}

carmine pebbleBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

sudden temple
#

#include <iostream>

int main(){
int x;
std::cout << "type a number: ";
cin << x;
std::cout << "Your number is; " << x;
}

#

thats my code

#

Reference to overloaded function could not be resolved; did you mean to call it?

#

thats my error highlight the "c" in "cin"

waxen ruin
#

Hi

sudden temple
#

hello

waxen ruin
#

Change your cin << x to cin >> x

sudden temple
#

ok, but hold on

#

stay there and ill let you know the results 🙂

waxen ruin
#

Ye

sudden temple
#

the error is still the same

waxen ruin
#

Here

#

Uh

sudden temple
#

yes?

waxen ruin
#
#include <iostream>

int main(){
    int x;
    std::cout << "type a number: ";
    std::cin >> x;
    std::cout  << "Your number is: " << x;
}
#

Oh wait

#

Try that

sudden temple
#

it works!

waxen ruin
#

cin is also part of std

#

But yeah!

sudden temple
#

Thanks mate!

#

Have a good night!

#

!solved