A voir également:
- Calculatrice code blocks
- Calculatrice en c - Meilleures réponses
- Programme d'une calculatrice en langage c - Meilleures réponses
- Programmation d'une calculatrice en C - Forum - C
- Comment compiler avec code blocks ✓ - Forum - C
- Code blocks ne compile pas ✓ - Forum - C
- Installer code blocks linux ✓ - Forum - Linux / Unix
- Cannot open output file bin debug permission denied code blocks - Forum - Programmation
2 réponses
sakoba2010
- Messages postés
- 157
- Date d'inscription
- lundi 7 février 2011
- Statut
- Membre
- Dernière intervention
- 24 juillet 2013
remplaces ça
int nombre = 0, int nombre1 = 0, int nombre2 = 0;
par ça:
int nombre = 0, nombre1 = 0, nombre2 = 0;
tu peux aussi utiliser while avec switch pour mieux gérer une calculatrice. voir un exemple:
http://sakoba.byethost13.com/2011/05/10/calculator-on-c/
int nombre = 0, int nombre1 = 0, int nombre2 = 0;
par ça:
int nombre = 0, nombre1 = 0, nombre2 = 0;
tu peux aussi utiliser while avec switch pour mieux gérer une calculatrice. voir un exemple:
http://sakoba.byethost13.com/2011/05/10/calculator-on-c/
BallKrasher
//calculator making operations beetween two numbers
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
void main()
{
int t;
printf("PROGRAM FOR OPERATIONS BEETWEEN TWO NUMBERS\n enter:\n1 to make addition,\n2 to make substraction,\n3 to make multiplication,\n4 to make division.\n");
scanf("%d", &t);
switch(t)
{
case 1:sum();break;
case 2:substract();break;
case 3:multi();break;
case 4:diviz();
default:t!=(1, 2, 3, 4 );printf("%d IS NOT AN OPERATION CODE.\n",t );
}
printf(" \\\\\\END OF THE PROGRAM\\\\\\ \n");
getch();
}
sum()
{
float a, b;
printf("\\\\\\ADDITION\\\\\\ \nenter a&b values: \n");
scanf("%f %f", &a, &b);
printf("a+b= %f + %f = %.4f \n",a, b, a+b);
return 0;
}
substract()
{
float a, b;
printf("\\\\\\SUBSTRACTION\\\\\\ \nenter a&b values: \n");
scanf("%f %f", &a, &b);
printf("a-b= %f - %f = %.4f \n",a, b, a-b);
return 0;
}
multi()
{
float a, b;
printf("\\\\\\MULTIPLICATION\\\\\\ \nenter a&b values: \n");
scanf("%f %f", &a, &b);
printf("a*b= %f * %f = %.4f \n",a, b, a*b);
return 0;
}
diviz()
{
float a, b;
printf("\\\\\\DIVISION\\\\\\ \nenter a&b values: \n");
scanf("%f %f", &a, &b);
printf("a/b= %f / %f = %.4f \n",a, b, a/b);
return 0;
}
impress()
{
FILE *imprim;
imprim=fopen("PRN","wt");
fprintf(imprim,"Exemple d'impression!\n");
fclose(imprim);
}
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
void main()
{
int t;
printf("PROGRAM FOR OPERATIONS BEETWEEN TWO NUMBERS\n enter:\n1 to make addition,\n2 to make substraction,\n3 to make multiplication,\n4 to make division.\n");
scanf("%d", &t);
switch(t)
{
case 1:sum();break;
case 2:substract();break;
case 3:multi();break;
case 4:diviz();
default:t!=(1, 2, 3, 4 );printf("%d IS NOT AN OPERATION CODE.\n",t );
}
printf(" \\\\\\END OF THE PROGRAM\\\\\\ \n");
getch();
}
sum()
{
float a, b;
printf("\\\\\\ADDITION\\\\\\ \nenter a&b values: \n");
scanf("%f %f", &a, &b);
printf("a+b= %f + %f = %.4f \n",a, b, a+b);
return 0;
}
substract()
{
float a, b;
printf("\\\\\\SUBSTRACTION\\\\\\ \nenter a&b values: \n");
scanf("%f %f", &a, &b);
printf("a-b= %f - %f = %.4f \n",a, b, a-b);
return 0;
}
multi()
{
float a, b;
printf("\\\\\\MULTIPLICATION\\\\\\ \nenter a&b values: \n");
scanf("%f %f", &a, &b);
printf("a*b= %f * %f = %.4f \n",a, b, a*b);
return 0;
}
diviz()
{
float a, b;
printf("\\\\\\DIVISION\\\\\\ \nenter a&b values: \n");
scanf("%f %f", &a, &b);
printf("a/b= %f / %f = %.4f \n",a, b, a/b);
return 0;
}
impress()
{
FILE *imprim;
imprim=fopen("PRN","wt");
fprintf(imprim,"Exemple d'impression!\n");
fclose(imprim);
}