+ 1
Can someone help me complete this code? I want the user to input something and want my code to the appropriate output.
#include <iostream> using namespace std; void printSomething(int a) { cout<<a; } void printSomething(char a) { cout<<"please enter an integer!"; } int main() { printSomething(); return 0; }
3 ответов
0
void printSomething(){
int input;
cout <<"Enter a value :";
cin >> input;
cout <<"\nEntered: " <<input <<endl;
}
0
Not what I am looking for! I want the program to accept both a int or char but if an integer is not entered i want to print "please enter an integer".
0
Add if statement.. finish your course also.