I need to put these below in full code program using c++ just creat any idea to
ID: 3850969 • Letter: I
Question
I need to put these below in full code program using c++
just creat any idea to use theses in any simple code with some discription how is it work
What is the output?
max(0, main (-1.0));
--------------------------------------------------------------------------------------------------
second question
detrimene if this is true or not with discription why
------------------------
int z; int main(void) {int z;cout<
-------------------------------
char y[ ]='s','0','7'};
--------------------------------
double g(void) {return -1.0;}
Explanation / Answer
1.
#include <iostream>
int main(int argc, char* argv[])
{
std::cout << max(0,main(-1.0);
return 0;
}
Output:
Error Because main function expects two values i.e argc and argv
In function 'int main(int, char**)':
7:33: error: too few arguments to function 'int main(int, char**)' 4:5: note: declared here
2.
#include <iostream>
int z=10;
int main(void)
{
std::cout << z;
return z;
}
Output:
10
Explanation: The main also a function so we can pass empty values to the main function. in the above program, we are passing no value but returning the value of z.
3.
#include <iostream>
int main(void)
{
char y[ ]={'s','0','7'};
return z;
}
Explanation:
The correct way to declare the array values is within the square braces.
4.
#include <iostream>
using namespace std;
double g();
int main(void)
{
double val=g();
cout<<val;
return 0;
}
double g(void)
{return -1.0;}
Output:
-1.0