0
why does this code does not work properly
code needs to ask for a value then be displayed with function printSomething. then it needs to multiply value by 2. IDK why it returns weird values https://code.sololearn.com/ckF9t1jtjXoj/?ref=app
3 odpowiedzi
+ 4
the code is working properly. but when you does not enter a value it choose some random value.
try int x=0;
or any default value.
+ 2
They are printing next to each other, so when input is 8 printSomething prints 8 and then
cout << timesTwo(x) << endl; print 16 without first placing a newline, so you should change printSomething to this:
void printSomething(int x) {
cout << x << endl;
}
+ 1
thanks a lot. can't believe it was that simple