Toplam 5 sonuçtan 1 ile 5 arasındakiler gösteriliyor.

Konu: Arkadaşlar çok acele c ödevi bi yerinde tıkandım.

  1. #1
    ACEMİ ER
    Üyelik tarihi
    Sep 2005
    Mesajlar
    3
    Forum Katkısı:
    0

    Standart Arkadaşlar çok acele c ödevi bi yerinde tıkandım.


  2. #2
    ACEMİ ER
    Üyelik tarihi
    Sep 2005
    Mesajlar
    3
    Forum Katkısı:
    0

    Standart

    Tamamdır beyler gece gece görememişim çok salakça bi hata var.
    Düzenlemeleri yapıp buraya da yollarım belki birinin işine yarar ;) kolay gelsin..

    Edit: Düzeltmeler tamam buyrun arklar..

    Kod:
    /* Task: Write a program with a menu for choosing the next functions: */
    /* a) Function enters an integer array P[k], k<25; */
    /* b) Function that finds the elements, which belong to a define interval [a,b] and save them in a new array PN; */
    /* c) Function that sorts this array (PN) descending. */
    
    #include <iostream.h>
    #include <conio.h>
    int main()
    {
        int P[25],i,N,PN[25],j,tempi,temps,k=1,l=2,m=3,a,b,p,r;
    /* First menu */
    label1:
        cout<<"\n\t\tMenu";
        cout<<"\n\t 1. Enter an array \n";
        cout<<"\t 2. Enter interval and see the new array which \n\tbelong to the interval (it needs 1st)\n";
        cout<<"\t 3. Sort the new interval (it needs 1st and 2nd)\n";
        /* Entering the selection from the menu */
        cout<<"Your choise:";
        cin>>k;
        /* Control the selection is true or false */
        /* If it is false it must be reentered */
        if(k>=1 && k<=3)
        {
             switch (k)
             {
                  case 1: cout<<"\n\tStarting first step:";
                       /* Taking the information about how many elements will be used */
                       do{cout<<"\n How many elements you have:";
                       cin>>N;}
                       while(N<1||N>25);
                            /* Entering each elements to the array */
                            for(i=0;i<N;i++)
                            {
                                 cout<<"\n Input "<<i+1<<" number:";
                                 cin>>P[i];
                            }break;
                  case 2: cout<<"\nFirst you must enter the array\n";goto label1;break;
                  case 3: cout<<"\nFirst you must enter the array\n";goto label1;break;
             }
        }
        /* if the menu selection is false user jumps to the begining of the first menu */
        else goto label1;
    /* The end of the first menu */
    /* Second menu */
    label2:
        cout<<"\n\t\tMenu";
        cout<<"\n\t 1. Enter an array (done)\n";
        cout<<"\t 2. Enter interval and see the new array which \n\tbelong to the interval\n";
        cout<<"\t 3. Sort the new interval (it needs 2nd)\n";
        /* Entering the selection from the menu */
        cout<<"Your choise:";
        cin>>l;
        /* Control the selection is true or false */
        /* If it is false it must be reentered */
        if(l>=1 && l<=3)
        {
             switch (l)
             {
                  /* If user try to enter selection 1 it is continue from selection 2*/
                  /* Because selection 1 has already done */
                  case 1: cout<<"\n\tYou have chosen 1. Enter an array but this has already done";
                  case 2: cout<<"\n\tStarting the second step\n";
                       /* Taking the informaion about interval */
                       cout<<"Enter the interval [a,b]";
                       cout<<"\na=";
                       cin>>a;
                       cout<<"\nb=";
                       cin>>b;
                       /* If the interval isn't in order it must be get order */
                       if(a>b)
                       {tempi=a;a=b;b=tempi;}
                       /* After ordering step finding elements which belongs to the interval */
                       for(j=0,i=0;i<N;i++)
                       {
                            p=P[i];
                            if(p>a && p<b)
                            {PN[j]=P[i];j++;}
                       }
                       /* Printing the new array */
                       cout<<"\n New array: ";
                       for(i=0;i<j;i++)
                       cout<<PN[i]<<"  ";break;
                  case 3: cout<<"\nYou hadn't done the second step, yet.\n";goto label2;break;
             }
        }
        /* if the menu selection is false user jumps to the begining of the second menu */
        else goto label2;
    /* The end of the second menu */
    /* Third menu */
    label3:
        cout<<"\n\t\tMenu";
        cout<<"\n\t 1. Enter an array (done)\n";
        cout<<"\t 2. Enter interval and see the new array which \n\tbelong to the interval (done)\n";
        cout<<"\t 3. Sort the new interval\n";
        /* Entering the selection from the menu */
        cout<<"Your choise:";
        cin>>m;
        /* Control the selection is true or false */
        /* If it is false it must be reentered */
        if(m>=1 && m<=3)
        {
             switch (m)
             {
                  case 1: cout<<"\n\tYou have chosen 1. Enter an array but this has already done";
                  case 2: cout<<"\n\tYou have chosen 2. Interval control but this has already done\n";
                  case 3: cout<<"\nStarting the third step\n";
                       /* Sorting the New array */
                       for(i=0;i<j-1;i++)
                            for(r=i+1;r<j;r++)
                            if(PN[i]<PN[r])
                            {
                                 temps=PN[i];
                                 PN[i]=PN[r];
                                 PN[r]=temps;
                            }
                       /* Printing the sorted array */
                       cout<<"\n Sorted Array: ";
                       for(i=0;i<j;i++)
                       cout<<PN[i]<<"  ";
             }
        }
        /* if the menu selection is false user jumps to the begining of the third menu */
        else goto label3;
    /* The end of the tird menu */    
    cout<<"\n\nThe End\n";
    /* The end of the program */
    getch();
    return 0;
    }
    Araya bilgi satırları da ekledim kolay görülebilsin die ;)

  3. #3
    ALBAY
    Üyelik tarihi
    Jul 2006
    Mesajlar
    2,717
    Forum Katkısı:
    0

    Standart

    gece gece mi ?
    Dünya yıkılacak da olsa, birak adalet yerini bulsun..

  4. #4
    ACEMİ ER
    Üyelik tarihi
    Sep 2005
    Mesajlar
    3
    Forum Katkısı:
    0

    Standart

    Alıntı simba Nickli Üyeden Alıntı Mesajı göster
    gece gece mi ?
    Dün gece yazmıştım saat 1 den 4 e kadar hatayı aradım Sonunda buraya yazdım =)

    Ancak bana verebileceğin bir tavsiye varsa yazdığım kod ile ilgili zevkle dinlemeye hazırım. Proglamlama konusunda daha çok yeniyim. Her türlü tavsiyeye ihtiyacım var.

  5. #5
    ACEMİ ER
    Üyelik tarihi
    Dec 2007
    Mesajlar
    1
    Forum Katkısı:
    0

    Standart

    arkadaşlar selam ya ben c ye yeni başladım sınavsa &#231;ıkacak &#246;dev sorularım var yardım ederseniz sevinirim
    1.klavyeden s ve n giriliyor,dizinin s nolu elemanından başlayarak n adet eleman yazdıran prog.
    2.Dizinin ilk n elemanı dizinin sonuna atayan ve bastakileri sıfırlayan prog.
    3.Dizide ekrandan girilen sayidan kucuk cift sayıların ve tek sayıların sayısını veren prog
    4.1-dizinin ilk n elemanını ,2-dizinin son n elemanını, 3-dizinin son n elemanını sondan basa dogru yazdıran prog

Konu Bilgisi

Users Browsing this Thread

Şu anda 1 üyemiz bu konuya göz atıyor. (0 kayıtlı üye ve 1 misafir.)

Bu Konuyu Paylaşın !

Bu Konuyu Paylaşın !

Yetkileriniz

  • Konu Acma Yetkiniz Yok
  • Cevap Yazma Yetkiniz Yok
  • Eklenti Yükleme Yetkiniz Yok
  • Mesajınızı Değiştirme Yetkiniz Yok
  •  
Garantili SEO - Moradam