What's wrong with this code?! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong with this code?!

#include <iostream> using namespace std; int print() {cout<< "print output" << endl;} int result(int a,int b) int main() { print(); result(5,6); return: 0; } // Function definition int result(int a,int b) { cout<< a + b; }

9th Nov 2016, 7:19 PM
Georgios Bariamai
Georgios Bariamai - avatar
6 Answers
+ 4
1) missing semicolon (;) right after result function declaration (just above main) 2) extra (:) between return and 0 at the end of the main() function
9th Nov 2016, 7:23 PM
Burey
Burey - avatar
+ 3
Fixed: #include <iostream> using namespace std; int print() { cout<< "print output" << endl; } int result(int a,int b); int main(){ print(); result(5,6); return 0; } // Function definition int result(int a,int b) { cout<< a + b; }
9th Nov 2016, 7:31 PM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
+ 2
No problem, were always here to help
9th Nov 2016, 7:34 PM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
0
Thanks! 😊 Defaulting proved to be a hard task! (I'm sorry for my English.. )
9th Nov 2016, 7:34 PM
Georgios Bariamai
Georgios Bariamai - avatar
0
can some one give me a start point on prigramming using C++
9th Nov 2016, 8:16 PM
Leonard
Leonard - avatar
0
Leonard, what do you mean?
9th Nov 2016, 8:32 PM
Georgios Bariamai
Georgios Bariamai - avatar