programme deviner un nombre
Bonjour j'aurais besoin d'aide pour mon programme, voici l'exercice :
Ecrire un algorithme qui choisi au hasard un nombre entre 1 et 100 mais ne l'affiche pas. Pour trouver le nombre secret le programme n'indique que "trop petit";"trop grand". A la fin de la partie le programme affiche "gagné".
J'ai deja commencer a l'élaboration du programme ce qui donne sa :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| #include <stdio.h>
#include <stdlib.h>
void Rand(){
int R;
R == rand()%100;
scanf("%d", &R);
}
int main(){
int N;
int R;
printf("Entrez un nombre :");
scanf("%d", &N);
Rand();
if (N<Rand());
else if (printf("TROP PETIT \n"));
if (N>Rand());
else if (printf("TROP GRAND \n"));
if (N=Rand());
else if (printf("GAGNER \n"));
return 0;
} |
mais voila en compilant le programme j'ai un message d'érreur affichant :
Code:
1 2 3 4
| In function main:
rand.c:18: error: void value not ignored as it ought to be
rand.c:21: error: void value not ignored as it ought to be
rand.c:24: error: void value not ignored as it ought to be |
j'aimerais pouvoir résoudre ce petit problème si cela est possible