diff --git a/ch2/01.cpp b/ch2/01.cpp new file mode 100644 index 0000000..e6eacaa --- /dev/null +++ b/ch2/01.cpp @@ -0,0 +1,12 @@ +# include +using namespace std; + +int main(){ + string your_name, your_adress; + cout << "Enter Your Name" << endl; + cin >> your_name; + cout << "Enter Your Adress" << endl; + cin >> your_adress; + cout << "Your Name: " << your_name << endl <<"Your Adress: " << your_adress << endl; + return 0; +} diff --git a/ch2/02.cpp b/ch2/02.cpp new file mode 100644 index 0000000..bf1362c --- /dev/null +++ b/ch2/02.cpp @@ -0,0 +1,11 @@ +# include +using namespace std; + +int main(){ + int long_value, ma_value; + cout << "Enter Long" << endl; + cin >> long_value; + ma_value = 220 * long_value; + cout << "Ma is " << ma_value << endl; + return 0; +} diff --git a/ch2/03.cpp b/ch2/03.cpp new file mode 100644 index 0000000..4a56a4a --- /dev/null +++ b/ch2/03.cpp @@ -0,0 +1,15 @@ +# include +using namespace std; +void Double_wd (string b, string c); + +int main(){ + Double_wd ("Three blind mice", "See how they run"); + return 0; +} + +void Double_wd (string b, string c){ + string wd1, wd2, wd3; + wd1 = b; + wd2 = c; + cout << wd1 << endl << wd1 << endl << wd2 << endl << wd2 << endl; +} diff --git a/ch2/04.cpp b/ch2/04.cpp new file mode 100644 index 0000000..f1344f0 --- /dev/null +++ b/ch2/04.cpp @@ -0,0 +1,11 @@ +# include +using namespace std; + +int main(){ + int yr_value, mn_value; + cout << "Enter Your Eage" << endl; + cin >> yr_value; + mn_value = 12 * yr_value; + cout << "It contains " << mn_value << " Months"<< endl; + return 0; +} diff --git a/ch2/05.cpp b/ch2/05.cpp new file mode 100644 index 0000000..4652f79 --- /dev/null +++ b/ch2/05.cpp @@ -0,0 +1,11 @@ +# include +using namespace std; + +int main(){ + double ce_value, fa_value; + cout << "Enter Celsisus value: "; + cin >> ce_value; + fa_value = 1.8 * ce_value + 32; + cout << ce_value << "degree Celsisus is " << fa_value << " degrees Fahrenheit" << endl; + return 0; +} diff --git a/ch2/06.cpp b/ch2/06.cpp new file mode 100644 index 0000000..92047d5 --- /dev/null +++ b/ch2/06.cpp @@ -0,0 +1,11 @@ +# include +using namespace std; + +int main(){ + double ly_value, au_value; + cout << "Enter the number of light years: "; + cin >> ly_value; + au_value = int(63240 * ly_value); + cout << ly_value << " light years = " << au_value << " astronomical unites" << endl; + return 0; +} diff --git a/ch2/07.cpp b/ch2/07.cpp new file mode 100644 index 0000000..24acdaa --- /dev/null +++ b/ch2/07.cpp @@ -0,0 +1,17 @@ +# include +using namespace std; +void time_output(int h, int m); + +int main(){ + int h, m; + cout << "Enter the number of hours: "; + cin >> h; + cout << "Enter the number of minutes: "; + cin >> m; + time_output(h,m); + return 0; +} + +void time_output(int h, int m){ + cout << "Time: " << h << ":" <