Page 1 of 2 12 LastLast
Results 1 to 25 of 26

Thread: C

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Banned
    Join Date: Jun:2006
    Location: sofia
    Posts: 68

    C

    .
    : " . 3 . , , . ( strcat(to,from) ). :"Noviyat niz e: %S", . . : "Izberete edno ot pokazanite po-gore iregheniya (cifra ot 1 do 3):", . switch ( strcat(to,from)) i se izdava syob]enie:" Finalniyat niz moje da vi haresa: \n%s". . () .
    : char *Sg[] = {"vseki_","den_","se_","chudya_","i_","" se_","maya_"};.
    : "gde shte mu izleze kraya." , "dali tryabva da si traya." , " i za programata nehaya.".
    : strcat(to.from) - "to" , ; "from" , ."



  2. #2
    Get a Mac moridinbg's Avatar
    Join Date: Dec:2004
    Location: 0x00000000
    Posts: 4,211
    strcat char* . strcat("hello ", "world") "hellow world".

    ? .

  3. #3
    Registered User
    Join Date: Dec:2007
    Location: Sofia
    Posts: 366
    ,

    strcat() - . .
    - :
    1. Sg
    2. ,
    2.1. 3-
    2.2. 1 3, 2.1.
    2.3. ,
    2.4. , , '' , ( 3)
    2.5. 2.1.
    3. !

    , . , , .

    @moridinbg - , , (- ).

  4. #4
    Deleted User 4eRNoBiL's Avatar
    Join Date: Oct:2005
    Location:
    Posts: 739
    moridinbg e , "Hello world".

    strcat , , .. : ="Kondio qde " b="spanak", strcat(a,b) b, , , "Kondio qde spanak", strcat "" &a.

    , ...
    Fujistu Lifebook E756 | Core i7-6500U / 400MHz-3.1GHz | 8 GB DDR4-2133 | Samsung PM871 / 256 GB SSD | 15" 1920x1080 | Manjaro Linux + kernel 4.19

  5. #5
    Registered User
    Join Date: Dec:2007
    Location: Sofia
    Posts: 366
    Quote Originally Posted by 4eRNoBiL View Post
    moridinbg e , "Hello world"
    ! 'Access violation' exception.
    Hint: 12- , "Hello world"? ?

  6. #6
    Banned
    Join Date: Jun:2006
    Location: sofia
    Posts: 68
    Quote Originally Posted by Pheoman View Post
    ,

    strcat() - . .
    - :
    1. Sg
    2. ,
    2.1. 3-
    2.2. 1 3, 2.1.
    2.3. ,
    2.4. , , '' , ( 3)
    2.5. 2.1.
    3. !

    , . , , .

    @moridinbg - , , (- ).
    . - .

  7. #7
    Banned
    Join Date: Jun:2006
    Location: sofia
    Posts: 68

  8. #8
    Registered User
    Join Date: Dec:2007
    Location: Sofia
    Posts: 366
    while (1)
    {
    // --
    // -------
    if (----1--3)
    continue;
    // ---------
    if (--)
    break;
    }

    printf() puts()
    getch() gets()
    atoi()

  9. #9
    Get a Mac moridinbg's Avatar
    Join Date: Dec:2004
    Location: 0x00000000
    Posts: 4,211
    , . strcat e
    Code:
    char tmp1[20] = "Hello ";
    char tmp2[] = "World";
    strcat(str1, str2);
    tmp1 "Hello world". 12 . 20 .

  10. #10
    Registered User
    Join Date: Dec:2007
    Location: Sofia
    Posts: 366
    , - C/C++.

    . - , - . -

    char result[12]; // 12
    char *tmp1 = "Hello ";
    char *tmp2 = "world";
    strcpy(result, tmp1); //
    strcat(result, tmp2); // , result "Hello world"

  11. #11
    Get a Mac moridinbg's Avatar
    Join Date: Dec:2004
    Location: 0x00000000
    Posts: 4,211
    , , 12 .

  12. #12
    Deleted User 4eRNoBiL's Avatar
    Join Date: Oct:2005
    Location:
    Posts: 739
    ! 'Access violation' exception.
    , ! , "Hello" "world" , .
    Fujistu Lifebook E756 | Core i7-6500U / 400MHz-3.1GHz | 8 GB DDR4-2133 | Samsung PM871 / 256 GB SSD | 15" 1920x1080 | Manjaro Linux + kernel 4.19

  13. #13
    Banned
    Join Date: Jun:2006
    Location: sofia
    Posts: 68
    Code:
    #include<stdio.h>
    #include(conio.h>
    #include<string.h>
    void main
    {  intN;
    char *Sg[] = {"Vseki_","den_","se_","chudya_","i_","se_","maya_"};
    strcat

    http://www.cplusplus.com/reference/c...ng/strcat.html
    strcat ,
    .
    " strcat(to,from)" to i from

  14. #14
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    , @lz1nia. char temp[1000]. strcpy(temp, "") . strcat(temp, <>) <>, Sg[1] ( , , .. "den_"), , "alabala". , .
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

  15. #15
    Banned
    Join Date: Jun:2006
    Location: sofia
    Posts: 68
    Quote Originally Posted by anrieff View Post
    , @lz1nia. char temp[1000]. strcpy(temp, "") . strcat(temp, <>) <>, Sg[1] ( , , .. "den_"), , "alabala". , .
    .
    strcat (Sg[1000]) . .
    .

  16. #16
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448

    1) .
    2) , strcat .
    3) , strcat, .
    4) , for . , ( The for loop ). , .
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

  17. #17
    Banned
    Join Date: Jun:2006
    Location: sofia
    Posts: 68
    Code:
    #include<stdio.h>
    //#include(conio.h>
    //#include<string.h>
    int main()
    {
    char *Sg[] = {"Vseki_","den_","se_","chudya_","i_","se_","maya_"};
    for(int i=0; i<7; i++)
    {
    printf(Sg[i]);
    }
    
    return 0;
    }
    . , ?

  18. #18
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    ? Dev-CPP, :

    1) system("pause"); return 0;
    2) .
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

  19. #19
    Banned
    Join Date: Jun:2006
    Location: sofia
    Posts: 68
    Borland C version 3.1

  20. #20

  21. #21
    Banned
    Join Date: Jun:2006
    Location: sofia
    Posts: 68
    Code:
    #include<stdio.h>
    #include<iostream.h>
    #include<conio.h>
    
    
    
    int main()
    {
     char *Sg[] = {"vseki_","den_","se_","chudya_","i_","se_","maya_"};
     for (int i = 1; i < 7; i++)
     {
      strcat(Sg[0],Sg[i]);
     }
     printf("Noviyat niz e: %S");
     printf(Sg[0]);
    
     char *Sg2[] = {"gde shte mu izleze kraya.","dali tryabva da si traya."," i za programata nehaya."};
    
     for (int j = 0; j < 3; j++)
     {
      printf(Sg2[j]);
      printf("\n");
     }
     printf("Izberete edno ot pokazanite po-gore iregheniya (cifra ot 1 do 3):");
     int n;
     scanf("%d", &n);
     switch (n)
     {
      case n = 1 : {printf(Sg[0]);printf(Sg2[n]);}
      case n = 2 : {printf(Sg[0]);printf(Sg2[n]);}
      case n = 3 : {printf(Sg[0]);printf(Sg2[n]);}
      default : printf("Ibrali ste newalidno ireghenie");
     }
    
    return 0;
    }
    8 :
    1. function 'strcat should have a prototype
    2. case n = 1 : {printf(Sg[0]);printf(Sg2[n]);} constant expression required
    3. case 3 - duplicate case
    4. case 3 -case outside ot switch
    5. return 0; - declaration terminated incorectly


  22. #22
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    1. #include <string.h>
    2. :
    Code:
    switch (n)
    {
    case 1: ...
    case 2: ...
    default: ...
    }
    case break;, .
    3. 4. 5. 2.
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  23. #23
    Banned
    Join Date: Jun:2006
    Location: sofia
    Posts: 68
    , .
    ?
    Code:
    #include<stdio.h>
    #include<iostream.h>
    #include<conio.h>
    #include<string.h>
    
    
    int main()
    {
     char *Sg[] = {"vseki_","den_","se_","chudya_","i_","se_","maya_"};
     for (int i = 1; i < 7; i++)
     {
      strcat(Sg[0],Sg[i]);
     }
     printf("Noviyat niz e: %S");
     printf(Sg[0]);
    
     char *Sg2[] = {"gde shte mu izleze kraya.","dali tryabva da si traya."," i za programata nehaya."};
    
     for (int j = 0; j < 3; j++)
     {
      printf(Sg2[j]);
      printf("\n");
     }
     printf("Izberete edno ot pokazanite po-gore iregheniya (cifra ot 1 do 3):");
     int n;
     scanf("%d", &n);
     switch (n)
     {
      case  1 : {printf(Sg[0]);printf(Sg2[n]);}
      break;
      case  2 : {printf(Sg[0]);printf(Sg2[n]);}
      break;
      case  3 : {printf(Sg[0]);printf(Sg2[n]);}
      default : printf("Ibrali ste newalidno ireghenie");
     }
    
    return 0;
    }

  24. #24
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    1) printf() :
    Code:
    char *s[] = {"hi", "bye"};
    printf("Blablabla, I wanted to say %s", s[0]);
    .. printf(), "%s" .

    2) strcat()- , char temp[1000] = ""; strcat(temp, Sg[i]);

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

  25. #25
    Banned
    Join Date: Jun:2006
    Location: sofia
    Posts: 68
    :
    Code:
    #include <conio.h>
    #include <stdio.h>
    #include <string.h>
    
    int main( )
    {
      int   i, j, n;
      char  StrResult[200] = "";
      char *Sg[]  = {"vseki_", "den_", "se_", "chudya_", "i_", "se_", "maya_"};
      char *Sg2[] = {"gde shte mu izleze kraya.",
                     "dali tryabva da si traya.",
                     " i za programata nehaya."};
    
      for ( i = 0; i < 7; i++ )
        strcat( StrResult, Sg[i] );
    
      printf("Noviyat niz e: %s\n\n", StrResult );
    
      for ( j = 0; j < 3; j++ )
        printf( "%d) %s\n", j + 1, Sg2[j] );
    
      printf( "Izberete edno ot pokazanite po-gore iregheniya (cifra ot 1 do 3):");
      scanf( "%d", &n );
    
      if ( n < 1 || n > 3 )
        printf( "Izbrali ste newalidno izrechenie!\n" );
      else {
        strcat( StrResult, Sg2[n-1] );
        printf( "Finalniyat niz moje da vi haresa:\n%s\n", StrResult );
      }
    
      getch();
      return 0;
    }
    , conio.h ????

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 |