1.
#include <iostream>
int main()
{
using namespace std;
cout<<"abc";
cout<<endl;
cout<<"abcd";
return 0;
}
2.
#include <iostream>
using namespace std;
int main()
{
int l,m;
cout<<"Please enter long:";
cin>>l;
m=l*220;
cout<<"=";
cout<<m;
cout<<"ma";
return 0;
}
3.
#include<iostream>
using namespace std;
void function_a();
void function_b();
int main()
{
function_a();
function_a();
function_b();
function_b();
return 0;
}
void function_a()
{
cout<<"Three blind mice"<<endl;
}
void function_b()
{
cout<<"See how they run"<<endl;
}
4.
#include<iostream>
using namespace std;
int main()
{
int age,month;
cout<<"Enter your age:";
cin>>age;
month=age*12;
cout<<"Contain "<<month<<" months";
return 0;
}
5.
#include<iostream>
using namespace std;
int change(int);
int main()
{
int celsius,fahrenheit;
cout<<"Please enter a Celsius value:";
cin>>celsius;
fahrenheit=change(celsius);
cout<<celsius<<" degrees Celsius is "<<fahrenheit<<" degrees Fahrenheits.";
return 0;
}
int change(int n)
{
int m;
m=1.8*n+32.0;
return m;
}
6.
#include<iostream>
using namespace std;
double trans(double x);
int main()
{
double lightyear,au;
cout<<"Enter the number of light years:";
cin>>lightyear;
au=trans(lightyear);
cout<<lightyear<<" light years="<<au<<"astronomical units.";
return 0;
}
double trans(double x)
{
double au=63240*x;
return au;
}
7.
#include<iostream>
using namespace std;
void trans(int a,int b);
int main()
{
int hour,min;
cout<<"Enter the number of hours:";
cin>>hour;
if(hour<0||hour>24)
{
cout<<"It's not a correct time!";
return 0;
}
else
{
}
cout<<"Enter the number of minutes:";
cin>>min;
if(min<0||min>60)
{
cout<<"It's not a correct time!";
return 0;
}
else
{
}
trans(hour,min);
return 0;
}
void trans(int a,int b)
{
cout<<"Time:"<<a<<":"<<b;
}