Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void demain(int jour, int mois, int annee)
- {
- int tab_mois[13] = {-1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1};
- if ( ((jour > 29) && (annee % 4 == 0)) )
- printf("bug");
- if ( ((jour == 31) && (tab_mois[mois] == 1)) || ((jour == 30) && (tab_mois[mois] == 0))
- || ((jour == 29) && (annee % 4 == 0)) || ((jour == 28) && (annee % 4 == 1))) {
- jour = 1;
- if (mois + 1 > 12) {
- mois = 1;
- annee++;
- }
- else
- mois++;
- }
- else
- jour++;
- printf("%d:%d:%d\n", jour, mois, annee);
- }
- void complete(int *a, char *b, int *c)
- {
- printf("nbr 1 :");
- scanf("%d", a);
- printf("operation : ");
- scanf(" %c", b);
- printf("nbr2 : ");
- scanf(" %d", c);
- }
- void calculatrice()
- {
- int a = 0;
- char b = 0;
- int c = 0;
- int resultat = 0;
- char tab_operateur[4] = {'+', '*', '/', '-'};
- complete(&a, &b, &c);
- for (int i = 0; tab_operateur[i]; i++) {
- if (tab_operateur[i] == b) {
- if (b == '+')
- resultat = a + c;
- if (b == '*')
- resultat = a * c;
- if (b == '/' && c != 0)
- resultat = a / c;
- if (b == '-')
- resultat = a - c;
- }
- }
- printf("resultat is : %d\n", resultat);
- }
- int main(int argc, char *argv[])
- {
- //demain(atoi(argv[1]), atoi(argv[2]), atoi(argv[3]));
- calculatrice();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement