1.
#include<iostream>
using namespace std;
int main() {
string s1, s2;
cout << "enter you name: ";
cin >> s1;
cout << " Enter your address: ";
cin >> s2;
cout << s1 << " live in " << s2 << endl;
return 0;
}
2.
#include<iostream>
using namespace std;
int transform(int);
int main() {
int longMetre;
cout << "Enter the longMetre: ";
cin >> longMetre;
int size = transform(longMetre);
cout << longMetre << " long= " << size << " size." << endl;
return 0;
}
int transform(int n) {
return 220 * n;
}
3.
#include<iostream>
using namespace std;
void blind() {
cout << "three blind mice" << endl;
}
void run() {
cout << "See how they run" << endl;
}
int main() {
blind();
blind();
run();
run();
return 0;
}
4.
#include<iostream>
using namespace std;
int main() {
cout << "Enter your age: ";
int age;
cin >> age;
cout << "you have pass " << 12 * age << " mouths" << endl;
return 0;
}
5.
#include<iostream>
using namespace std;
double transform(double Celsius) {
return 1.8 * Celsius + 32.0;
};
int main() {
double Celsius;
cout << "Enter a Celsius value: ";
cin >> Celsius;
cout << Celsius << " degrees Celsius is " << transform(Celsius) << " degrees Fahrenheit." << endl;
return 0;
}
6.
#include<iostream>
using namespace std;
double convert(double lightYear);
int main() {
double light_year;
cout << "Enter the number of light years: ";
cin >> light_year;
cout << light_year << " light years = " << convert(light_year) << " astronomical inots." << endl;
return 0;
}
double convert(double lightYear) {
return 63240 * lightYear;
}
7.
#include<iostream>
using namespace std;
void showTime(int hour, int minutes);
int main() {
int x, y;
cout << "Enter the number of hours: ";
cin >> x;
cout << "Enter the munber of minutes: ";
cin >> y;
showTime(x, y);
return 0;
}
void showTime(int hours, int minutes) {
cout << "Time: " << hours << " : " << minutes << endl;
}