Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
I'm a beginner in C++, and i'm learning functions. In some programs, the function prototype is included within main(), while in some no?
I've a doubt, when do we declare prototype below namespace_std and when within main ()?
Please help me. Thanks.
BA up for grabs.
2 Answers
- 5 years ago
.actually main is the parent function of all the functions in C .If we don't need any return value we use return type 'void'. we can also use ' int' as return type.after all main() is also a function there is a flexibility of mentioning return type to it by user .
Without using namespace std; when you write for example cout <<; you'd have to put std::cout <<;
Here's a small example for you:
1
2
3
4
5
6
7
8
9
#include <iostream>
int main()
{
std::cout << "Hello World";
system("pause");
return 0;
}
Edit & Run
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World";
system("pause");
return 0;
}
Edit & Run
They both do the exact same thing.
- SunsuLv 55 years ago
Despite warning, my wife, with help of a loan agent created a fake bank account statement and a 2nd new pan card has taken a 42L loan. Risk?