Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main();
- int age[] = {17,24};
- string name[] = {"roma","dima"};
- //***************************************************************************************
- void baza()
- {
- do
- {
- cout << "vvedite id: ";
- int id;
- cin >> id;
- if(id > 0 && id < 3)
- {
- cout << endl << "age: " << age[id-1] << endl << "name: " << name[id-1] << endl;
- }
- if(id < 1 || id > 2)
- {
- cout << "error" << endl;
- }
- do
- {
- cout << endl << "hotite prodolzit?: ";
- string vopros;
- cin >> vopros;
- if(vopros == "net")
- {
- cout << endl;
- main();
- }
- if(vopros != "da")
- {
- cout << endl << "error(!=(da,net))" << endl;
- }
- if(vopros == "da")
- {
- cout << endl;
- baza();
- }
- }
- while(true);
- }
- while(true);
- }
- //********************************************************************************
- void function()
- {
- cout << "dopolnitelnie funkchii" << endl
- << "1 - naiti samogo starshego" << endl
- << "2 - naiti srednij vozrast" << endl
- << "3 - redaktor" << endl << endl
- << "vvedite punct: ";
- int punct;
- cin >> punct;
- if(punct < 1 || punct > 3)
- {
- cout << "error" << endl;
- }
- if(punct == 1)
- {
- int a = 0;
- int b = 0;
- for(int i = 0 ; i < 2 ; i++)
- {
- if(a < age[i])
- {
- a = age[i];
- b = i;
- }
- }
- cout << endl << "age: " << age[b] << endl << "name: " << name[b] << endl << endl;
- main();
- }
- if(punct == 2)
- {
- int resultat = 0;
- for(int i = 0 ; i < 2 ; i++)
- {
- resultat += age[i];
- }
- resultat /= 2;
- cout << endl << "srednij vozrast: "<< resultat << endl << endl;
- main();
- }
- }
- //********************************************************************************
- int main()
- {
- {
- cout << "punct list" << endl
- << "1 - baza dannix" << endl
- << "2 - dopolnitelnie funkchii" << endl
- << "3 - exit" << endl << endl
- << "vvedite punct: ";
- int punct;
- cin >> punct;
- cout << endl;
- if(punct < 1 || punct > 3)
- {
- cout << "error" << endl;
- }
- if(punct == 2)
- {
- function();
- }
- if(punct == 1)
- {
- baza();
- }
- if(punct == 3)
- {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement