#include<iostream>
using namespace std;
int n, ar[100];
void takin()
{
cout <<"number of element: "; cin>> n;
cout <<"put in the elements: ";
for(int x=0; x<n; x++)
{
cin>> ar[x];
}
}
void show()
{
cout <<"\nelements are: ";
for(int y=0; y<n; y++)
{
cout <<ar[y] <<' ';
}
}
void precal()
{
cout <<"\n\nPre-Cal: ";
for(int z=0; z<n; z++)
{
ar[z+1]+=ar[z];
cout <<ar[z] <<' ';
}
}
int main()
{
takin(); show(); precal();
cout <<endl<<endl<<endl<<endl<<endl;
return 777;
}
using namespace std;
int n, ar[100];
void takin()
{
cout <<"number of element: "; cin>> n;
cout <<"put in the elements: ";
for(int x=0; x<n; x++)
{
cin>> ar[x];
}
}
void show()
{
cout <<"\nelements are: ";
for(int y=0; y<n; y++)
{
cout <<ar[y] <<' ';
}
}
void precal()
{
cout <<"\n\nPre-Cal: ";
for(int z=0; z<n; z++)
{
ar[z+1]+=ar[z];
cout <<ar[z] <<' ';
}
}
int main()
{
takin(); show(); precal();
cout <<endl<<endl<<endl<<endl<<endl;
return 777;
}
could you pls xplain the use of return 777
ReplyDeletesure, you see here the data type of 'return' is integer since the 'main()' function is itself an integer type. now i can make 'return' to hold and send back any integer type data ( of course in a limit and type casting is a different thing) all i have to do is to introduce it to any int number.
ReplyDeleteso writing a 'return 0' or 'return 777' is just same thing.