C++ Yazılım Problemi

Galiba bu şekilde oluyor.
Kod:
#include <stdio.h>

int main()
{
    printf("*********************************************\n");
    printf("Kullanici -1 yazana kadar program calisacak.\n");
    printf("*********************************************\n");

    int sayi, buyuksayi = 0, kucuksayi = 999999;

        for(int i;; i++)
    {
        printf("%d. sayiyi giriniz:",i+1);
        scanf("%d",&sayi);
      
        if (sayi > buyuksayi)
        {
            buyuksayi = sayi;
        }
        if (sayi < kucuksayi && sayi != -1)
        {
            kucuksayi = sayi;
        }
        if(sayi == -1){
            break;
        }
    }

    printf("Büyük sayi:%d\nKücük sayi is:%d",buyuksayi,kucuksayi);

    return 0;
}
 
Son düzenleme:
Kodu çalıştırmayı denetim fakat fazlasıyla hata verdi:
In function 'int main()':
[Error] in C++98 'V' must be initialized by constructor, not by '{...}'
[Error] 'INT32_MAX' was not declared in this scope
[Error] 'i' does not name a type
[Error] expected ';' before 'i'
[Error] 'i' was not declared in this scope
[Error] 'buyuk' was not declared in this scope
[Error] 'buyuk' was not declared in this scope
INT32_MAX yerine 2147483647 yazabilirsiniz.
Dev-C++'ta derleyiciye komut girme seçeneği var. Tools>Compiler Options menüsünde "Add the following commands to the compiler" seçeneğini işaretleyip oradaki kutuya -std=c++11 komutunu girip derleyin.
 
Galiba bu şekilde oluyor.
Kod:
#include <stdio.h>

int main()
{
    printf("*********************************************\n");
    printf("Kullanici -1 yazana kadar program calisacak.\n");
    printf("*********************************************\n");

    int sayi, buyuksayi = 0, kucuksayi = 999999;

        for(int i;; i++)
    {
        printf("%d. sayiyi giriniz:",i+1);
        scanf("%d",&sayi);
    
        if (sayi > buyuksayi)
        {
            buyuksayi = sayi;
        }
        if (sayi < kucuksayi && sayi != -1)
        {
            kucuksayi = sayi;
        }
        if(sayi == -1){
            break;
        }
    }

    printf("Büyük sayi:%d\nKücük sayi is:%d",buyuksayi,kucuksayi);

    return 0;
}

Çok teşekkür ederim. Sonunda düzgünce çalıştı. 🙂
Herkese yardımlarından dolayı teşekkür ederim.
 
Uyarı! Bu konu 6 yıl önce açıldı.
Muhtemelen daha fazla tartışma gerekli değildir ki bu durumda yeni bir konu başlatmayı öneririz. Eğer yine de cevabınızın gerekli olduğunu düşünüyorsanız buna rağmen cevap verebilirsiniz.

Technopat Haberler

Yeni konular

Geri
Yukarı