Results 1 to 6 of 6

Thread: C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Hard Core Gaming HardDrive's Avatar
    Join Date: Jun:2006
    Location:
    Posts: 754

    C++

    :
    Code:
    :
    void arrayfill(int a[], int size)
    {
         for(int i=0; i<size; i++)
         {
                 cout<<"input element "<<i<<" "; cin>>a[i];
         }
    }
    
    :
    int v[10];
    int len=10;
    arrayfill(v,len);

    ?
    Code:
    :
    int* newarray(int arr[], int oldSize, int newSize)
    {
         
         int* newArr= new int[newSize];
         
         //ako stariq razmer e po maluk ot noviq, trqbva da kopirame elementite ot stariq masiv v noviq
         if(oldSize<=newSize)
         {
                            for(int i=0; i<oldSize; i++)
                            {
                                    newArr[i]=arr[i];
                            }
         }
         
         //ina4e noviq masiv e po maluk i 6te kopirame vuzmojno nai mnogo elementi
         else
         {
                             for(int i=0; i<newSize; i++)
                             {
                                     newArr[i]=arr[i];
                             }
         }
         
         //triem stariq array
         delete[] arr;
         arr=0;
         
         return newArr; //vru6tam ukazatel za noviq array
                            
    }
    
    
    
        int a[0];
        int size=0;
    a=newarray(a, size, ns);
    int* arr, . .
    Config: Ryzen 3700x / Gigabyte x570 Gaming X / RX480 Strix 1400@2250 / 2x8gb Corsair Vengeance / Seagate Barracuda 1Tb + 256gb OCZ Trion / SuperFlower Leadex II Gold 750w / BeQuiet B801 / LG 23MA53 + Philips 170c / Logitech G502 / CM QuickFire TK

    Acer Predator G9-593 I7 7700HQ + GTX1070

  2. #2
    Registered User
    Join Date: Dec:2007
    Location: Sofia
    Posts: 366
    , 'a'. ++ , modifiable lvalue, .. .

    .

  3. #3
    Hard Core Gaming HardDrive's Avatar
    Join Date: Jun:2006
    Location:
    Posts: 754
    , ?
    Config: Ryzen 3700x / Gigabyte x570 Gaming X / RX480 Strix 1400@2250 / 2x8gb Corsair Vengeance / Seagate Barracuda 1Tb + 256gb OCZ Trion / SuperFlower Leadex II Gold 750w / BeQuiet B801 / LG 23MA53 + Philips 170c / Logitech G502 / CM QuickFire TK

    Acer Predator G9-593 I7 7700HQ + GTX1070

  4. #4
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    - C++ int a[10], C++ , " ". ,

    Code:
    a++
    ,
    ,

    Code:
    a[12] = 5
    , ( , a 10 ).

    , " " - "", .. 'a' , "" .

    , '' " ", .
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

  5. #5
    Bombera's Avatar
    Join Date: Jul:2001
    Location: 4EVA
    Posts: 13,833
    :
    int a[0];
    . :
    delete[] arr; // arr e a, .
    , :
    int *a = new int[0];
    .
    0 , .
    EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
    Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|

  6. #6
    Hard Core Gaming HardDrive's Avatar
    Join Date: Jun:2006
    Location:
    Posts: 754
    ! ^^ !
    , , ?
    :
    Code:
    int* newarray(int* arr, int oldSize, int newSize)
    {
         
         int* newArr= new int[newSize];
         
         //ako stariq razmer e po maluk ot noviq, trqbva da kopirame elementite ot stariq masiv v noviq
         if(oldSize<=newSize)
         {
                            for(int i=0; i<oldSize; i++)
                            {
                                    newArr[i]=arr[i];
                            }
         }
         
         //ina4e noviq masiv e po maluk i 6te kopirame vuzmojno nai mnogo elementi
         else
         {
                             for(int i=0; i<newSize; i++)
                             {
                                     newArr[i]=arr[i];
                             }
         }
         
         //triem stariq array
         delete[] arr;
         arr=0;
         
         return newArr; //vru6tam ukazatel za noviq array
                            
    }
    Config: Ryzen 3700x / Gigabyte x570 Gaming X / RX480 Strix 1400@2250 / 2x8gb Corsair Vengeance / Seagate Barracuda 1Tb + 256gb OCZ Trion / SuperFlower Leadex II Gold 750w / BeQuiet B801 / LG 23MA53 + Philips 170c / Logitech G502 / CM QuickFire TK

    Acer Predator G9-593 I7 7700HQ + GTX1070

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 |