Results 1 to 11 of 11

Thread: c++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Apr:2011
    Location:
    Posts: 90

    c++

    , :
    a1,a2,....,an b1,b2...,bn n . () - .

    , , - , 2 2 - 100 100
    ?


    #include <stdio.h>
    #include <math.h>
    #include <conio.h>
    void main ()
    {
    int a[20];
    int b[20];
    int c[20];
    int p[20];
    int n;

    printf("vavedete broq na triagalnicite"); scanf("%d",&n);
    for (int i=0; i<n; i++){

    printf("vavedete kateta a"); scanf("%d",&a[i]);
    printf("vavedete kateta b"); scanf("%d",&b[i]); }

    for (i=0; i<n; i++) {
    c[i]=sqrt((a[i]*a[i])+(b[i]*b[i]));
    p[i]=a[i]+b[i]+c[i]; }
    int maxp=0;
    for (i=1; i<n; i++)
    if (p[i]>p[maxp]) maxp=i;
    printf("nomera na triagalnika s nai golqm perimetar e %d",maxp);
    getch();
    }

  2. #2
    Developer/Gamer tengam's Avatar
    Join Date: Feb:2005
    Location:
    Posts: 1,459
    ++ , ++?
    |ASUS RoG Z690-E i7-13700k@ 5.6/4.3Ghz + Kraken X63 216GB Kingston Fury Beast 6000hmz 32-40-40-28 | RTX4080 | 256GB 960Evo, 1TB 970Evo, 2x2TB 980Pro, 1TB 860Evo|HX1200|CM MasterCase Pro 5|
    |Steam Deck 256GB | 36 TB Unraid NAS| Asus Z87-DELUXE i7-4790K 32GB DDR3|
    TengaM#2700 / 7engaM

  3. #3
    Registered User
    Join Date: Apr:2011
    Location:
    Posts: 90
    C C++

  4. #4
    Bombera's Avatar
    Join Date: Jul:2001
    Location: 4EVA
    Posts: 13,833
    Quote Originally Posted by FeldMarschal View Post
    int maxp=0;
    C++ e C, .
    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|

  5. #5
    Developer/Gamer tengam's Avatar
    Join Date: Feb:2005
    Location:
    Posts: 1,459
    , ++, . , , ++
    |ASUS RoG Z690-E i7-13700k@ 5.6/4.3Ghz + Kraken X63 216GB Kingston Fury Beast 6000hmz 32-40-40-28 | RTX4080 | 256GB 960Evo, 1TB 970Evo, 2x2TB 980Pro, 1TB 860Evo|HX1200|CM MasterCase Pro 5|
    |Steam Deck 256GB | 36 TB Unraid NAS| Asus Z87-DELUXE i7-4790K 32GB DDR3|
    TengaM#2700 / 7engaM

  6. #6
    Registered User
    Join Date: Apr:2011
    Location:
    Posts: 90
    - .
    Visual c++

  7. #7
    Registered User
    Join Date: Jul:2004
    Location:
    Posts: 621
    , . :-)

    , c[i] p[i] . . , float double, sqrt() .

    .. .... , 0? , - , "nomera na triagalnika s nai golqm perimetar e 0"

  8. #8
    Registered User
    Join Date: Apr:2011
    Location:
    Posts: 90
    ... 0

    ---------- 12:11 ---------- 12:03 ----------

    0
    1?

  9. #9
    Registered User
    Join Date: Jul:2004
    Location:
    Posts: 621
    +1 "":
    Code:
    printf("nomera na triagalnika s nai golqm perimetar e %d",maxp + 1);

  10. #10
    Game programmer
    Join Date: Feb:2007
    Location:
    Posts: 1,948
    Quote Originally Posted by tengram
    , ++, . , , ++
    C++ , , pre-standard headers. C-style

    Quote Originally Posted by DimKo View Post
    +1 "":
    Code:
    printf("nomera na triagalnika s nai golqm perimetar e %d",maxp + 1);
    //off

    , , 0
    3700X | 3070Ti | 64GB RAM | 2TB SSD | Seasonic 750W | FD Define 7 Mini

  11. #11
    Registered User
    Join Date: Apr:2011
    Location:
    Posts: 90
    - ,


    #include <stdio.h>
    #include <math.h>
    #include <conio.h>
    void main ()
    {

    int n;

    printf("vavedete broq na triagalnicite: "); scanf("%d",&n);
    float *a=new float[n];
    float *b=new float[n];
    float *c=new float[n];
    float *p=new float[n];

    for (int i=0; i<n; i++){

    printf("\nvavedete kateta a na %d-i: ",i+1); scanf("%f",&a[i]);
    printf("vavedete kateta b na %d-i: ",i+1); scanf("%f",&b[i]); }

    for (i=0; i<n; i++) {
    c[i]=sqrt((a[i]*a[i])+(b[i]*b[i]));
    p[i]=a[i]+b[i]+c[i]; }


    int ind_max=0;
    for (i=0; i<n; i++)
    if (p[i]>p[ind_max]) ind_max=i;

    printf("\nnai golqm perimetar imat triagalnika/cite s nomer:\n");
    for (i=ind_max; i<n; i++)
    if (p[i]==p[ind_max]) printf("%d\n",i+1);


    getch();
    delete []a;
    delete []b;
    delete []c;
    delete []p;

    }

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 |