Results 1 to 6 of 6

Thread: C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User ogun's Avatar
    Join Date: Jul:2009
    Location:
    Posts: 3,936

    C++

    ,
    :
    Code:
    char mqsto_trugvane[60];
          char mqsto_pristigane[60];
          int km;
          double cena;
          int chas_trugvane[2];
          int chas_pristigane[2];
          int data_pristigane[3];
          int data_trugvane[3];
          int korekten;
    ?
    :
    masiv[0] - mqsto_pristigane
    masiv[1] - mqsto_trugvane
    ..

    masiv?
    , . ? char?
    .

  2. #2
    Registered User 4004's Avatar
    Join Date: Apr:2011
    Location: BG
    Posts: 2,061
    . - .

  3. #3
    Registered abUser ike's Avatar
    Join Date: Jul:2004
    Location: sofi
    Posts: 4,965
    Have no fear ike iz here.
    CPU Cx486DLC@40MHz, RAM 4MB, VGA Trident 512KB, HDD Conner 160MB, Monitor 14" Color

  4. #4
    Registered User ogun's Avatar
    Join Date: Jul:2009
    Location:
    Posts: 3,936
    .
    Code:
    class bilet{
    struct info{
          char mqsto_trugvane[60];
          char mqsto_pristigane[60];
          int km;
          double cena;
          int chas_trugvane[2];
          int chas_pristigane[2];
          int data_pristigane[3];
          int data_trugvane[3];
          int korekten;
    };
          bilet(){
                info info;
          }
    };
    mqsto_trugvane info[0]

    info[0] , info.mqsto_trugvane, ?

    .

  5. #5
    Executor Lan's Avatar
    Join Date: Nov:2005
    Location:
    Posts: 3,304
    Operator overloading, google .

    :



    Code:
    //   :
    char* operator[] (const int nIndex);
    
    // :
    char** bilet::operator [](const int nIndex)
    {
       if (b == 0)
         return &mqsto_trugvane;
    }
    c++ char* ...
    [0] char*, [1] char*
    Last edited by Lan; 20th May 2011 at 19:02.
    I mourn thee by dusk | I mourn thee by dawn
    Crave for thy gloss | to seek the silent glades beyond

  6. #6
    Registered User
    Join Date: Sep:2009
    Location: Shumen
    Posts: 12
    , . .
    Code:
    #include <iostream>
    using namespace std;
    
    class bilet{
    struct info{
          char mqsto_trugvane[60];
          char mqsto_pristigane[60];
          int km;
          double cena;
          int chas_trugvane[2];
          int chas_pristigane[2];
          int data_pristigane[3];
          int data_trugvane[3];
          int korekten;
    };
    public:
    	bilet() 
    	{
    		all = new info [100];
    		count=0;
    	}
    	bilet(long maximum)
    	{
    		all = new info [maximum];
    		count=0;
    	}
    	~bilet()
    	{
    		delete[] all;
    	}
    	void set_bilet(char* mqsto_trygvane, char* mqsto_pristigane)
    	{
    		strcpy(all[count].mqsto_trugvane,mqsto_trygvane);
    		strcpy(all[count].mqsto_pristigane,mqsto_pristigane);
    		count++;
    	}
    	void get_bilet()
    	{
    		for (int i=0; i<count; i++)
    			cout<<all[i].mqsto_trugvane<<' '<<all[i].mqsto_pristigane<<endl;
    	}
    private:
    	long max_data;
    	info *all;
    	long count;
    };
    
    void main ()
    {
    	bilet *bi = new bilet();
    	bi->set_bilet("Paris","New York");
    	bi->set_bilet("London","Tokyo");
    	bi->get_bilet();
    	
    }

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 |