Sadece C kullanarak basit bir hesap oluşturdum Şimdi benim kodumla, sadece bir seferde işlemleri 1 hesaplayabiliyorum. bu nedenle, hesapımı yeniden yapmak veya ti yapısına sahip olmadan başka bir program yapmak için hangi kodu veya döngüyü kullanmalıyım?Çok Temel C işlevi
`
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
float first_value;
float second_value;
char Operation;
printf("Welcome to Shoeb's first calculator :)\nChoose your operation (a for Addition/s for Subtraction/m for Multiplication/d for Division) \nPress small o when done calculation ^_^\n");
scanf("%s", &Operation);
if (Operation == 'a') {
printf("Type in your first number below.\n");
scanf("%f", &first_value);
printf("Type in you second value below.\n");
scanf("%f", &second_value);
printf("The result is %f", first_value+second_value);
}
if (Operation == 's') {
printf("Type in your first number below.\n");
scanf("%f", &first_value);
printf("Type in you second value below.\n");
scanf("%f", &second_value);
printf("The result is %f", first_value-second_value);
}
if (Operation == 'm') {
printf("Type in your first number below.\n");
scanf("%f", &first_value);
printf("Type in you second value below.\n");
scanf("%f", &second_value);
printf("The result is %f", first_value*second_value);
}
if (Operation == 'd') {
printf("Type in your first number below.\n");
scanf("%f", &first_value);
printf("Type in you second value below.\n");
scanf("%f", &second_value);
printf("The result is %f\n", first_value/second_value);
}
return 0;
}
`
'Scanf ("%" s, ve işlem) -'> 'scanf ("% c", ve işletme); 've kullanımı' –