#1:
#include "iostream"
using namespace std;
int main()
{
cout << "Your Name: John.\n";
cout << "Your Address: China.\n";
system("pause");
return 0;
}
#2:
#include "iostream"
using namespace std;
int main()
{
int _L, _M;
const int p = 220;
cout << "Please Enter(long): ";
cin >> _L;
_M = _L*p;
cout << "That is " << _M <<" yard"<<((_M > 1)? "s\n":"\n");
system("pause");
return 0;
}
#3:
#include "iostream"
using namespace std;
void Printf_1();
void Printf_2();
int main()
{
Printf_1();
Printf_1();
Printf_2();
Printf_2();
system("pause");
return 0;
}
void Printf_1()
{
cout << "Three blind mice\n";
}
void Printf_2()
{
cout << "See how they run\n";
}
#4:
#include "iostream"
using namespace std;
int main()
{
int _age;
const int p = 12;
cout << "Enter your age: ";
cin >> _age;
cout << "That is " << _age*p << " months\n";
system("pause");
return 0;
}
#5:
#include "iostream"
using namespace std;
float Conversion(float _celsius);
int main()
{
float celsius;
cout << "Please Enter a Celsius value: ";
cin >> celsius;
cout << celsius << " degree" << (celsius > 1 ? "s " : " ") << "Celsius is " << Conversion(celsius) << " degrees Fahrenheit\n";
system("pause");
return 0;
}
float Conversion(float _celsius)
{
return _celsius*1.8 + 32.0;
}
#6:
#include "iostream"
using namespace std;
void Conversion();
int main()
{
Conversion();
system("pause");
return 0;
}
void Conversion()
{
const unsigned long p = 63240;
float _lightYears;
unsigned long astronomicalUnits;
cout << "Enter the number of Light years: ";
cin >> _lightYears;
astronomicalUnits = _lightYears*p;
cout << _lightYears << " light year" << (_lightYears > 1 ? "s " : " ") << "= " << astronomicalUnits << " astronomical units.\n";
}
#7:
#include "iostream"
using namespace std;
void show(int _hours, int _minutes);
int main()
{
int hours, minutes;
cout << "Enter the number of hours: ";
cin >> hours;
cout << "Enter the number of minutes: ";
cin >> minutes;
show(hours, minutes);
system("pause");
return 0;
}
void show(int _hours, int _minutes)
{
cout << "Time: " << _hours << ":" << _minutes << endl;
}