+ 1
Codewars C++ registration question
Signing up for C++ on codewars.com they ask us to fix this code: int multiply(int a, int b) { a * b; } I wrote my own code since they simply want me to multiply a and b: #include <iostream> // for std::cout and std::cin int main() { int a{}; int b{}; std::cout << "Please enter any two numbers between 0 and 10 and click enter.\n"; std::cin >> a; std::cin >> b; std::cout << a * b; return 0; } It gives multiple errors, can someone tell me what the correct code is for the registration and why is my code wrong?
6 odpowiedzi
+ 3
Farhan Ali I think they just wanted you to put the 'return' keyword in the function.
int multiply(int a, int b) {
return a * b;
}
+ 3
Missing return keyword in function declaration
return a*b
0
Oh, alright. Thanks for helping!
0
Use the return statement bro.
Thats missing.
0
It still isn't working for me, any ideas?
0
Int add(int a, int b) {
return a + b;
}
Int main() {
Int result = add(5, 3)
return 0;
}