Q&A Discussions
#include <iostream>
using namespace std;
int sum(int a, int b=42) {
int result = a + b;
return (result);
}
int main() {
int x = 24;
int y = 36;
//calling the function with both parameters
int result = sum(x, y);
cout << result << endl;
//calling the function without b
result = sum(x);
cout << result << endl;
return 0;
}
why is da last function cout 66 and not 48 isn't it suppose to add 24+24?
1 Vote
6 AnswersLine breaks
1 Vote
3 Answerswhat will be output??
#include <iostream>
using namespace std;
int main(int a)
{
cout << a << "\n";
return 0;
}
int main(char *a)
{
cout << a << endl;
return 0;
}
int main(int a, int b)
{
cout << a << " " << b;
return 0;
}
int main()
{
main(3);
main("Subodh");
main(9, 6);
return 0;
}
if output is compilation compilation error then how can we overload "main" function in C++
0 Votes
5 AnswersWhat is c?
0 Votes
5 Answersis games are created by c++
0 Votes
5 AnswersWhats wrong this code?
0 Votes
2 Answershow should I make a program
0 Votes
5 Answerscin >> question
0 Votes
3 AnswersHot today
Guys help please
1 Votes
Python question
2 Votes
Are websites hackable?
1 Votes
Python
1 Votes
TICTACTOE
0 Votes
C# and sql
1 Votes
What course to take for AI?
0 Votes
Error
0 Votes
What's an unsigned int?
0 Votes