Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- using namespace std;
- void jobOne(){
- cout<<"//////Вы выбрали задание 1.сохранение фимилии и имени в строчку//////"<<endl;
- string family,name;
- cout<<"Введите фамилию"<<endl;
- cin>>family;
- cout<<"Введите имя"<<endl;
- cin>>name;
- string FIO = family + ", " + name;
- cout<<"Информация сохраненая в строке :"<<FIO<<endl;
- }
- void jobTwo(){
- cout<<"//////Вы выбрали задание 2.Коробка конфет//////"<<endl;
- struct CandyBar
- {
- string title;
- double weight;
- int numberCalori;
- };
- CandyBar snack;
- cout<<"Введите название конфет"<<endl;
- cin>>snack.title;
- cout<<"Введите вес коробки"<<endl;
- cin>>snack.weight;
- cout<<"Введите количество калорий"<<endl;
- cin>>snack.numberCalori;
- cout<<"Название коробки "<<snack.title<<' '<<"ее вес "<<snack.weight<<" грамм, а количество калорий равно "<<snack.numberCalori<<endl;
- }
- void jobThree(){
- cout<<"//////Вы выбрали задание 3.Массив коробок конфет//////"<<endl;
- const int number = 2;
- struct CandyBar
- {
- string title;
- double weight;
- int numberCalori;
- };
- CandyBar snack[number];
- for(int i = 0;i<number;i++){
- cout<<"Введите название конфет"<<endl;
- cin>>snack[i].title;
- cout<<"Введите вес коробки"<<endl;
- cin>>snack[i].weight;
- cout<<"Введите количество калорий"<<endl;
- cin>>snack[i].numberCalori;
- system("cls");
- }
- for(int i = 0;i<number;i++){
- cout<<"Название коробки "<<snack[i].title<<' '<<"ее вес "<<snack[i].weight<<" грамм, а количество калорий равно "<<snack[i].numberCalori<<endl;
- cout<<endl;
- }
- }
- void jobFour(){
- cout<<"//////Вы выбрали задание 4.Результаты забегов//////"<<endl;
- int res[3];
- double srRes = 0;
- int numberSport = 3;
- for(int i =1;i<=numberSport;i++){
- cout<<"Введите результаты забега "<<i<<"-ого спортсмена"<<endl;
- cin>>res[i -1];
- srRes +=res[i -1];
- cout<<"Спортсмен пробежал дистанцию 40 метров за "<<res[i - 1]<<" секунд"<<endl;
- }
- srRes = srRes / (double)(numberSport);
- cout<<"Средний результат забега равен "<<srRes<<" секунд"<<endl;
- }
- int main()
- {
- setlocale(LC_ALL, "Russian");
- cout<<"Вся информация вводится только на английском языке!!!"<<endl;
- cout<<"1.Сохранение фимилии и имени в строчку"<<endl;
- cout<<"2.Коробка конфет"<<endl;
- cout<<"3.Массив коробок конфет"<<endl;
- cout<<"4.Результаты забегов"<<endl;
- cout<<"Введите номер интересуещего вас задания:"<<endl;
- int number;
- cin>>number;
- system("cls");
- if (number == 1)
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- using namespace std;
- void jobOne(){
- cout<<"//////¬˚ ‚˚·‡ÎË Á‡‰‡ÌËÂ Ó ÔÂÓ·‡ÁÓ‚‡ÌË ‚‡Î˛Ú˚//////"<<endl;
- cout<<"¬‚‰ËÚ ÍÓ΢ÂÒÚ‚Ó ‰ÓÎÓÓ‚, ÍÓÚÓÓ ·Û‰ÂÚ ÔÂÓ·‡ÁÓ‚‡Ì ‚ Û·ÎË"<<endl;
- double numberDolars;
- cin>>numberDolars;
- cout<<" Ó΢ÂÒÚ‚Ó Û·ÎÂÈ ‡‚ÌÓ = "<<numberDolars * 52.8150417<<endl;
- }
- void jobTwo(){
- cout<<"//////¬˚ ‚˚·‡ÎË Á‡‰‡ÌËÂ Ó ÔÓˆÂÌÚ ̇ÒÂÎÂÌˡ –ÓÒÒËË ‚ ÏËÂ//////"<<endl;
- unsigned long long populationWorld = 7212812960;
- unsigned long long populationRussian = 142725201;
- double oneProcent= double (populationWorld) / 100;
- double procentRussian = populationRussian / oneProcent;
- cout<<"œÓˆÂÌÚ ÛÒÒÍÓ„Ó Ì‡ÒÂÎÂÌˡ ËÁ ̇ÒÂÎÂÌˡ Ïˇ ‡‚ÂÌ"<<' '<<procentRussian<<' '<<'%'<<endl;
- }
- void jobThree(){
- cout<<"//////¬˚ ‚˚·‡ÎË Á‡‰‡ÌËÂ Ó ÔÓ‰Ò˜ÂÚ ÍÓ΢ÂÒÚ‚‡ ·ÛÍ‚ ‚ ‘»Œ//////"<<endl;
- string family,name,patronomic;
- cout<<"¬‚‰ËÚ هÏËÎ˲"<<endl;
- cin>>family;
- cout<<"¬‚‰ËÚ ËÏˇ"<<endl;
- cin>>name;
- cout<<"¬‚‰ËÚ ÓÚ˜ÂÒÚ‚Ó"<<endl;
- cin>>patronomic;
- system("cls");
- cout<<" Ó΢ÂÒÚ‚Ó ·ÛÍ‚ ‚:"<<endl<<"1.Ù‡ÏËÎËË="<<family.length()<<endl<<"2.ËÏÂÌË="<<name.length()<<endl<<"3.ÓÚ˜ÂÒÚ‚Â="<<patronomic.length()<<endl;
- }
- int visYear(int year){
- int difference= 2014 - year;
- int vesYear = 0;
- for (int i=0 ;i<difference;i++ ){
- if (((year + i) %400 == 0) && ((year + i) %100 == 0) && ((year + i) %4 == 0))
- vesYear++;
- else
- if (((year + i) %4 == 0) && ((year + i) %100) != 0)
- vesYear++;
- }
- return vesYear;
- }
- void jobFour(){
- int year;
- cout<<"//////¬˚ ‚˚·‡ÎË Á‡‰‡ÌËÂ Ó ÍÓ΢ÂÒÚ‚Â ‚ËÒÓÍÓÒÚÌ˚ı „Ó‰Ó‚ ̇ ÔÓÏÂÊÛÚÂ//////"<<endl;
- cout<<"“ÂÍÛ˘ÂÈ „Ó‰ 2014"<<endl;
- cout<<"¬‚‰ËÚ „Ó‰ ÓÚ ÍÓÚÓÓ„Ó ·Û‰ÂÏ Ò˜ËÚ‡Ú¸"<<endl;
- cin>>year;
- cout<<" Ó΢ÂÚÒ‚Ó ‚ËÒÓÍÓÒÚÌ˚ı „Ó‰Ó‚="<<visYear(year)<<endl;
- }
- void jobFive(){
- cout<<"//////¬˚ ‚˚·‡ÎË Á‡‰‡ÌËÂ Ó ÓÚÓ·‡ÊÂÌË ‚ÓÁ‡ÒÚ‡ ‚ ‰Ìˇı Ë ÏÂÒˇˆ‡ı//////"<<endl;
- struct data
- {
- int year;
- int month;
- int day;
- };
- data current,birthday;
- current.year = 2014;current.month = 1;current.day = 1;
- cout<<"¬‚‰ËÚ „Ó‰ ÓʉÂÌˡ"<<endl;
- cin>>birthday.year;
- cout<<"¬‚‰ËÚ ÏÂÒˇˆ ÓʉÂÌˡ"<<endl;
- cin>>birthday.month;
- cout<<"¬‚‰ËÚ ‰Â̸ ÓʉÂÌˡ"<<endl;
- cin>>birthday.day;
- cout<<" Ó΢ÂÒÚ‚Ó ÏÂÒˇˆÂ‚ ‡‚ÌÓ "<<((current.year - birthday.year) * 12) - birthday.month <<endl;
- cout<<endl;
- int numberVisYear = visYear(birthday.year) ;
- unsigned long long int numberDay;
- numberDay = ((current.year - birthday.year) - (1 + numberVisYear ) ) * 365 + (numberVisYear * 366);
- int difference;
- if (birthday.month == 1)
- difference = 31 - birthday.day;
- if (birthday.month == 2)
- difference = 28 - birthday.day;
- if (birthday.month == 3)
- difference = 31 - birthday.day;
- if (birthday.month == 4)
- difference = 30 - birthday.day;
- if (birthday.month == 5)
- difference = 31 - birthday.day;
- if (birthday.month == 6)
- difference = 30 - birthday.day;
- if (birthday.month == 7)
- difference = 31 - birthday.day;
- if (birthday.month == 8)
- difference = 31 - birthday.day;
- if (birthday.month == 9)
- difference = 30 - birthday.day;
- if (birthday.month == 10)
- difference = 31 - birthday.day;
- if (birthday.month == 11)
- difference = 30 - birthday.day;
- if (birthday.month == 12)
- difference = 31 - birthday.day;
- numberDay+=difference;
- for (int i = 1 ;i< (12 - current.month);i++ ){
- if (i == 1)
- numberDay += 31;
- if (i == 2)
- numberDay += 28;
- if (i == 3)
- numberDay += 31 ;
- if (i == 4)
- numberDay += 30;
- if (i == 5)
- numberDay += 31;
- if (i == 6)
- numberDay += 30;
- if (i == 7)
- numberDay += 31;
- if (i == 8)
- numberDay += 31;
- if (i == 9)
- numberDay += 30 ;
- if (i == 10)
- numberDay += 31;
- if (i == 11)
- numberDay += 30;
- if (i == 12)
- numberDay += 31;
- }
- cout<<" Ó΢ÂÒÚ‚Ó ‰ÌÂÈ ‡‚ÌÓ "<<numberDay<<endl;
- }
- void jobSix(){
- cout<<"//////¬˚ ‚˚·‡ÎË Á‡‰‡ÌËÂ Ó ÔÂÓ·‡ÁÓ‚‡ÌË ÒÂÍÛ̉ ‚ ÏËÌÛÚ˚, ˜‡Ò˚, ÒÛÚÍË//////"<<endl;
- cout<<"¬‚‰ËÚ ÍÓ΢ÂÒÚ‚Ó ÒÂÍÛ̉"<<endl;
- int sec;
- cin>>sec;
- double inMinuts,inHours,inDay;
- inMinuts = double(sec) / 60;
- inHours = inMinuts / 60;
- inDay = inHours/24;
- cout<<" Ó΢ÂcÚ‚Ó "<<sec<<" ÒÂÍÛ̉ ‚:"<<endl<<"1.ÏËÌÛÚ‡ı ="<<inMinuts<<endl<<"2.˜‡Ò‡ı ="<<inHours<<endl<<"3.‰Ìˇı ="<<inDay<<endl;
- }
- int main(){
- setlocale(LC_ALL, "Russian");
- cout<<"¬Òˇ ËÌÙÓχˆËˇ ‚‚Ó‰ËÚÒˇ ÚÓθÍÓ Ì‡ ‡Ì„ÎËÈÒÍÓÏ ˇÁ˚ÍÂ!!!"<<endl;
- cout<<"1.œÂÓ·‡ÁÓ‚‡ÌË ‰ÓÎÎÓÓ‚ ‚ Û·ÎË"<<endl;
- cout<<"2.œÓˆÂÌÚ Ì‡ÒÂÎÂÌˡ –ÓÒÒËË ËÁ ̇ÒÂÎÂÌˡ ÒÚ‡Ì˚"<<endl;
- cout<<"3.œÓ‰Ò˜ÂÚ ÍÓ΢ÂÒÚ‚ ·ÛÍ‚ ‚ ‘»Œ"<<endl;
- cout<<"4. Ó΢ÂÚÒ‚Ó ‚ËÒÓÍÓÒÚÌ˚ı „Ó‰Ó‚"<<endl;
- cout<<"5.ŒÚÓ·‡ÊÂÌˡ ‚ÓÁ‡ÒÚ‡ ‚ ‰Ìˇı Ë ÏÂÒˇˆ‡ı"<<endl;
- cout<<"6.œÂÓ·‡ÁÓ‚‡ÌË ÒÂÍÛ̉ ‚ ÏËÌÛÚ˚, ˜‡Ò˚, ÒÛÚÍË"<<endl;
- cout<<"¬‚‰ËÚ ÌÓÏ ËÌÚÂÂÒÛÂ˘Â„Ó ‚‡Ò Á‡‰‡Ìˡ"<<endl;
- int number;
- while (number !=0){
- cin>>number;
- system("cls");
- if (number ==1 )
- jobOne();
- if (number ==2 )
- jobTwo();
- if (number ==3 )
- jobThree();
- if (number ==4 )
- jobFour();
- if (number ==5 )
- jobFive();
- if (number ==6 )
- jobSix();
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement