Results 1 to 3 of 3

Thread: .

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Jul:2014
    Location: Varna
    Posts: 2

    .

    ! . , , . .

    :
    :
    ) ( ) ( 25) - :, -, , - I, II , , - . () ;
    ) ( );
    ) - .
    main() - . - .

    :


    #include <iostream>
    #include <fstream>
    #include <string>
    using namespace std;
    const int MAX = 25;
    int putuvaniq[MAX];
    struct maritime_station {
    char route [];
    char shipname[];
    char captainname[];
    int price_1 ;
    int price_2;
    int passengers_1;
    int passengers_2;
    int sold_tickets[];
    };

    void inserting (); // vuvejdane na danni za 1 korab
    void display (); // izvejdane na danni za korabite
    void ship_data (); // danni za prevozi na korab
    void travel (); // putuvane s nai-mnogo prodadeni bileti

    int main ()
    {
    int choice;
    cout<< "*************************************** ******" << endl;
    cout<< "*** MENU ***" << endl;
    cout<< "*** 1. Vuvejdane na danni ***" << endl;
    cout<< "*** 2. Izvejdane na danni ***" << endl;
    cout<< "*** 3. Danni za prevozi na korab ***" << endl;
    cout<< "*** 4. Informaciq za putuvane ***" << endl;
    cout<< "*************************************** ******" << endl;
    cout<< "Napishi svoqt izbor tuk: \n" ;
    cin >> choice;

    if ( choice < 5 && choice > 1)
    {
    switch (choice)
    {

    case 1:
    inserting ();
    break;
    case 2:
    display ();
    break;
    case 3:
    ship_data ();
    break;
    case 4:
    travel ();
    break;
    default:
    break;
    }

    }

    }

    void inserting()
    {
    int n; //broi putuvaniq
    cout<< "Vuvedete broq na putuvaniqta (do 25): "<<endl;
    cin >>n;
    fstream fp;
    fp.open("file.dat" , ios:ut ios::binary);
    fp.write(putuvaniq , sizeof (putuvaniq));
    for (int i=0; i<n ; i++);
    cout << "Vuvedete dannite za putuvane nomer " << i+1 << endl;
    cout << "Marshrut: " << endl;
    cin>> route;
    cout << "Ime na koraba: " <<endl;
    cin>> shipname;
    cout<< "Ime na kapitana: " <<endl;
    cin>> captainname;
    cout << "Ceni na bileti 1va klasa: "<<endl;
    cin>> price_1;
    cout << "Ceni na bileti 2ra klasa: "<<endl;
    cin>> price_2;
    cout<<"Broi putnici 1va klasa: "<<endl;
    cin>> passengers_1;
    cout<<"Broi putnici 2ra klasa: "<<endl;
    cin>> passengers_2;
    fp.close();

    }


    .

  2. #2
    System.gc()'s Avatar
    Join Date: Apr:2007
    Location: back in time
    Posts: 1,075
    ? " x, y, z", . , . , . : )
    UD3R|Q9550+1283|4x2 G.Skill@1066|MX500+1002FAEX+640AAKS+ST31 60|RX580-8GB|1841BLT|SS-760XP|Define7|z24i|Edifier S350DB
    geniusloci: ) ; ) ; ) ? nope|r.i.p.

  3. #3
    Registered User
    Join Date: Apr:2011
    Location:
    Posts: 90
    inserting() ...

    Code:
    void read(maritime_station *ms){	
    	cout << "Please insert the route: ";
    	cin >> ms->route;
    	
    	cout << "Please insert the name of the ship: ";
    	cin >> ms->shipname;
    	
    	cout << "Please insert the name of the captain: ";
    	cin >> ms->captainname;
    	
    	cout << "Please insert the price of the tier 1 ticket: ";
    	cin >> ms->price_1;
    	
    	cout << "Please insert the price of the tier 2 ticket: ";
    	cin >> ms->price_2;
    	
    	cout << "Please insert the number of the tier 1 passengers: ";
    	cin >> ms->passengers_1;
    	
    	cout << "Please insert the number of the tier 2 passengers: ";
    	cin >> ms->passengers_2;
    	
    	cout << endl;
    }
    main:
    Code:
    	int n = 2;
    	maritime_station arrayOfTravel[n];
    
    	for(int i = 0; i < n; i++){
    		read(&arrayOfTravel[i]);
    	}
    n cout cin
    ...
    - o - , .
    int


    Code:
    void write(maritime_station ms){
    		cout << "Route: " << ms.route << endl;
    		cout << "Ship name: " << ms.shipname << endl;
    		cout << "Captain name: " << ms.captainname << endl;
    		cout << "Tier 1 ticket price: " << ms.price_1 << endl;
    		cout << "Tier 2 ticket price: " << ms.price_2 << endl;
    		cout << "Tier 1 passengers number: " << ms.passengers_1 << endl;
    		cout << "Tier 2 passengers number: " << ms.passengers_2 << endl;	
    		
    		cout << endl;		
    }

    main
    Code:
    	for(int i = 0; i < n; i++){
    		write(arrayOfTravel[i]);
    	}
    main ,
    Last edited by FeldMarschal; 15th December 2014 at 18:39.

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 |