//2.7 -1
#include <iostream>
using namespace std;
int main()
{
string myName = "penenz";
string myAdress = "CSDN";
cout << "my name is : " << myName << endl;
cout << "myAdress is : " << myAdress << endl;
return 0;
}
//2.7 -2
#include <iostream>
using namespace std;
int main()
{
long distance;
cout << "Enter the distance (in long ):"<<endl;
cin >> distance;
long ma = distance * 220;
cout << ma;
return 0;
}
//2.7 -3
#include <iostream>
using namespace std;
void show_first()
{
cout << "Three blind mice" << endl;
}
void show_second()
{
cout << "See how they run" << endl;
}
int main()
{
show_first();
show_first();
show_second();
show_second();
return 0;
}
//2.7 -4
#include <iostream>
using namespace std;
int main()
{
int age;
cout << "Enter your age:";
cin >> age;
cout << "your age in moinths is " << age * 12 << endl;
return 0;
}
//2.7 -5
#include <iostream>
using namespace std;
double CelsiusToFahrenheit(double value)
{
return value * 1.8 + 32;
}
int main()
{
double value;
cout << "Please enter a Celsius value: ";
cin >> value;
cout << value << " degrees Celsius is " << CelsiusToFahrenheit(value) << " degrees Fahrenheit" << endl;
return 0;
}
//2.7 -6
#include <iostream>
using namespace std;
double LY2AU(const double ly)
{
return ly * 63240;
}
int main()
{
double ly;
cout << "Enter the number of light years:";
cin >> ly;
cout << ly << " light years = " << LY2AU(ly) << " astronomical units" << endl;
return 0;
}
//2.7 -7
#include <iostream>
using namespace std;
void show(const int hours, const int minutes)
{
cout << "Time : " << hours << ":" << minutes << endl;
}
int main()
{
int hours;
int minutes;
cout << "Enter the number of hours:";
cin >> hours;
cout << "Enter the number of minutes:";
cin >> minutes;
show(hours, minutes);
return 0;
}