folder Tahribat.com Forumları
linefolder C - C++
linefolder C++ Hakkında Yardım



C++ Hakkında Yardım

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    solstice
    solstice's avatar
    Kayıt Tarihi: 04/Nisan/2008
    Erkek

    hocalar bunun 1. ve 2. fonksiyonu oldu ancak son fonksiyonu halledemedim bilgisi olanlar yardımcı olursa sevinirim. tesekkürler.

     

     

    #include <iostream>
    #include <string>
    using namespace std;
    struct menutype
    {
        string menuitem;
        double menuprize;

    };
    void getdata (menutype a[]); //menülistesini klavyeden giriceksin sonra alt kısıma showmenu de  hepsini tekrar göstericek.
    void showmenu (menutype a[]); // cıkan menüden seçim yapılıcak diziye atılıcak.
    int printcheck (menutype a[]); //secimden sonra hepsine  vergi eklenip toplam fiyat gösterilicek.
    int main()
    {
        menutype a[5];
        getdata(a);
        showmenu(a);
        int x = printcheck (a);
        cout<<"toplam fiyat = "<<a[x].menuprize<<endl;
       
       
        return 0;
    }
    void getdata (menutype a[])
    {
            for(int i=1; i<6; i++)
            {
                cin>>a[i].menuitem>>a[i].menuprize;   
            }
    }
    void showmenu (menutype a[])
    {
        int menulist;
        for(int i=1;i<6;i++)
        {
            cout<<i<<". "<<a[i].menuitem<<" "<<a[i].menuprize<<"TL"<<endl;
        }
        char ch = 'y';
            cout<<"menuden secim icin y tusuna basiniz."<<endl;
        cin>>ch;
            while (ch=='y')
            {
                 cin>>menulist;
                double menu = a[menulist].menuprize;
                cout<<"secime devam etmek icin y cikmak icin n ye basiniz. "<<endl;
                double x=0;
                x=x+a[menulist].menuprize;
        cin>>ch;
            }
       
    }
    int printcheck (menutype a[])
    {
        int x = 0;
        for(int i=0; i<6; i++)
        {
        int    vergi= a[i].menuprize/10;
        x =a[i].menuprize+vergi;
       
        }
        return x;
       
    }


    https://www.youtube.com/watch?v=k6LrGZGqYn8
  2. KısayolKısayol reportŞikayet pmÖzel Mesaj
    NmC
    NmC's avatar
    Kayıt Tarihi: 23/Kasım/2008
    Erkek

    int printcheck (menutype a[])
    {
        int x = 0;
        for(int i=0; i<6; i++)
        {
        int    vergi= a[i].menuprize/10;
        x =a[i].menuprize+vergi;
       
        }
        return x;
       
    }

    bu sadece sana  son a'nin  değerini gösterir...

    eğer toplamı göstermek istiosan

    x = x + a[i].menuprize+vergi;

    seklinde degistir..

     


    There are 10 types of people in the world. Those who knows binary and those who dont...
  3. KısayolKısayol reportŞikayet pmÖzel Mesaj
    solstice
    solstice's avatar
    Kayıt Tarihi: 04/Nisan/2008
    Erkek

    peki hocam bunları double olarak değiştirdğimde neden hata veriyor bir bilgin varmı ? cünkü toplam fiyatı gösterirken sacma sapan sayi seklinde gösteriyor.

     

    double x = printcheck (a);
        cout<<"toplam fiyat = "<<a[x].menuprize<<endl;

    ve

     

    double x = 0; buraları değiştirdğimde oluyor.


    https://www.youtube.com/watch?v=k6LrGZGqYn8
  4. KısayolKısayol reportŞikayet pmÖzel Mesaj
    NmC
    NmC's avatar
    Kayıt Tarihi: 23/Kasım/2008
    Erkek

    double printcheck (menutype a[])
    {
        double x = 0;
        for(int i=0; i<6; i++)
        {
        double    vergi= a[i].menuprize/10;
        x =a[i].menuprize+vergi;
       
        }
        return x;
       
    }

    bu sekilde kullan fonksiyonu hocam..


    There are 10 types of people in the world. Those who knows binary and those who dont...
Toplam Hit: 1002 Toplam Mesaj: 4