Bilgisayar size 1’le 10 arasında iki sayıyı random olarak seçip çarpımlarını soruyor. Doğru bilirseniz random olarak bir tebrik mesajı veriyor. Bilemezseniz random olarak hata mesajı veriyor.


#include <stdio.h>
#include <stdlib.h>
void multiplication(void);
void correct(void);
void incorrect(void);
main()
{
int answer=0;



while (answer!=(-1))
{
multiplication();
printf(“do you want to countinue”);
scanf(“%i”,&answer);
}
}
void multiplication(void)
{
int x,y,z;
randomize();


x=rand()%10;
y=rand()%10;
printf(“how much is %i times %i
“,x,y);
cevapal:scanf(“%i”,&z);
if(z==(x*y))
{
correct();
}
else{
incorrect();
goto cevapal;
}
}
void correct(void)
{
int k;
randomize();
k=rand()%3;
if(k==0)
printf(“Very Good”);
else if (k==1)
printf(“Excellent!”);
else if (k==2)
printf(“Nice work!”);
else if (k==3)
printf(“Keep up the good work”);
}
void incorrect(void)
{
int c;
randomize();
c=rand()%3;
if(c==0)
printf(“No. Please try again”);
else if (c==1)
printf(“Wrong Try once more”);
else if (c==2)
printf(“Don’t give up!”);
else if (c==3)
printf(“No. Keep trying”);
}


Kaynak: Doğu Akdeniz Univ. CSIT Labworks
belgesi-413
Belgeci

Share
Published by
Belgeci

Recent Posts

Tek Mesele

Hiçbir şey, bir yığın hatırayı sıraya koymak için gereken ilk sessizlik anları kadar değerli olamaz.…

1 saat ago

The role of technology in reshaping the gambling landscape

The role of technology in reshaping the gambling landscape The Evolution of Online Gambling The…

2 saat ago

Heck Kenetlenme Reaksiyonu

2.1. Heck Coupling 2.1.1. Tanım 2.1.2. Katalitik Döngü                  Şekil 2.1.1. Klasik Heck döngüsünün mekanizması.…

13 saat ago

How is technology reshaping the future of casino gaming

How is technology reshaping the future of casino gaming The Rise of Online Gaming Platforms…

15 saat ago

De populairste kansspelen een gids voor beginners

De populairste kansspelen een gids voor beginners Wat zijn kansspelen? Kansspelen zijn spellen waarbij de…

16 saat ago

How Crypto Casinos Are Reshaping Digital Gaming With Blockchain Technology

The online gambling industry is experiencing a fundamental transformation as blockchain technology reshapes how players…

18 saat ago