Results 1 to 3 of 3

Thread: C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Jun:2011
    Location: varna
    Posts: 23

    C++

    2 -
    :
    - ( ) / 30/ " " , , , , ,
    - / /
    - - 20
    - main() -

    , - ,

    Code:
    #include <iostream>
    using namespace std;
    
    #define N 30 //max broi momicheta
    typedef struct
    {
        char nomer[10];
        char ime[10];
        char family[10];
        int age;
        float visochina;
        float teglo;
        char country[2];
    } girl;
    
    girl d[N];
    int top=0;
    float height;
    float weight;
    
    void load();
    void save();
    
    
    void input()
    {
        int i, n;
        do
        {
            cout<<"\n Kakuv e broq na uchastnichkite: ";
            cin>>n;
        }
        while (n<1||n>N);
        fflush(stdin);
        for(i=top; i<n;i++)
        {
            cout<<"\n Nomer: ";
            cin>>d[i].nomer;
            cout<<"\n Ime: ";
            cin>>d[i].ime;
            cout<<"\n Familiq: ";
            cin>>d[i].family;
            cout<<"\n Godini: ";
            cin>>d[i].age;
            cout<<"\n Visochina(cm): ";
            cin>>d[i].visochina;
            cout<<"\n Teglo(kg): ";
            cin>>d[i].teglo;
            cout<<"\n Durjava: ";
            cin>>d[i].country;
        }
        top+=n;
    }
    
    void disp(int i) 
    {
        cout<<"\n "<<d[i].nomer<<"\t"<<d[i].ime<<"\t"<<d[i].family<<"\t"<<d[i].age<<"\t"<<d[i].visochina<<"\t"<<d[i].teglo<<"\t"<<d[i].country<<endl;
    }
    
    
    void list()
    {
        int i;
        cout<<"\n Spisuk na ychastnichkite\n";
        for(i=0;i<top;i++)
        disp(i);
    }
    
    void teen()
    {
        int i;
    
        cout<<"\n Spisuk na ychastnichki pod 20 godini\n";
        for(i=0;i<top;i++)
        {
            d[i].age*=1;
            if(d[i].age<20)
                disp(i);
        }
    }
    
    int menu()
    {
        int ch;
    
        cout<<"\n 1. Vuvedi broq na ychasnitchkite";
        cout<<"\n 2. Izvedi spisuk na vsichki ychasnitchki";
        cout<<"\n 3. Izvedi spisuk na uchastnicki pod 20";
    
        cout<<"\n 4 Izhod";
    
        do
        {
            cout<<"\n Izbor: ";
            cin>>ch;
        }
        while(ch<1||ch>4);
            return(ch);
    }
    
    
    int main()
    {
        int i;
       
        load();
        do
        {
            i=menu();
            switch(i)
            {
            case 1: input();break;
            case 2: list();break;
            case 3: teen();break;
            case 4: save();break;
    ,
    main() :
    - / 100/
    -
    - "" .. , 3
    - ""

  2. #2
    Registered User vlex's Avatar
    Join Date: Jan:2008
    Location: Sofia
    Posts: 340
    cin>>d - - 80% . c in, .. cin>>c ..

    += . : , 0 1. 1 3, 6, 10 ... - +=1 =++.

    : - .. . .

    - 6 ( () ()) 6- . : int v = rand()%1000000;

    i -/ i+1. , .

    ( ( , , ) %)

    .

    , . ?

  3. #3
    Registered User
    Join Date: Jun:2011
    Location: varna
    Posts: 23
    /

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |