+ 9

What's the problem with it ? Kindly fix it and explain it to me ??

void showOnScreen() { cout<<"Programming makes life interesting"; } #include<iostream> using namespace std; int main() { char showOnScreen; cout<<showOnScreen; return 0; }

23rd Jun 2018, 5:42 PM
Shehroz Irfan
Shehroz Irfan - avatar
12 Respostas
+ 9
Nikhil Dhama thanks 👍👍
24th Jun 2018, 9:11 AM
Shehroz Irfan
Shehroz Irfan - avatar
+ 9
SUNIL BHAGAT thanks 👍
24th Jun 2018, 9:11 AM
Shehroz Irfan
Shehroz Irfan - avatar
+ 9
Learner thanks 👍
24th Jun 2018, 9:17 AM
Shehroz Irfan
Shehroz Irfan - avatar
+ 8
23rd Jun 2018, 5:44 PM
Shehroz Irfan
Shehroz Irfan - avatar
+ 8
Brains🇳🇬 thank you 👍
24th Jun 2018, 9:11 AM
Shehroz Irfan
Shehroz Irfan - avatar
23rd Jun 2018, 5:44 PM
Shehroz Irfan
Shehroz Irfan - avatar
23rd Jun 2018, 5:44 PM
Shehroz Irfan
Shehroz Irfan - avatar
+ 7
first of all always try to include headers before writing any other definitions. (it doesn't mean you cann't define earlier, yes you can, but it's better to define later and you will get to know this after taking a dive into programing) first you are defining fns and then later telling compiler that you are using namespace std, so in your fns defintion write cout as std:: cout, or include namespace earlier. second your calling of fn is incorrect. or in place you defined a char type variable with the same name as your fn's name. function calling should be like showonscreen(); //that's it
23rd Jun 2018, 5:50 PM
Nikhil Dhama
Nikhil Dhama - avatar
+ 6
Here showOnscreen is a function so you should make a function call for a proper execution <!--I think-->
23rd Jun 2018, 5:47 PM
Learner
+ 5
there are few errors in your code.
23rd Jun 2018, 5:46 PM
Nikhil Dhama
Nikhil Dhama - avatar
+ 3
You declared your namespace in the wrong place. namespaces and headers should be declared at the top..before any function declaration... thats why you have a "cout was not declared" error. and the function call is wrong..
23rd Jun 2018, 5:49 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 2
you don't need char line. only court<<showOnScreen();
23rd Jun 2018, 8:29 PM
SUNIL BHAGAT
SUNIL BHAGAT - avatar