Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * program2
- *
- * Copyright 2017 Tomasz Gromelski <tomgro@sl223-05>
- *
- */
- #include <stdbool.h>
- #include <stdio.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdbool.h>
- #include <stdlib.h>
- #include <stdint.h>
- int wczytaj(float d_gran, float g_gran)
- {
- int wartosc;
- scanf("%d", &wartosc);
- if (wartosc>d_gran && wartosc<g_gran)
- puts("Podana wartosc jest prawidlowa\n");
- else
- printf("liczba %d nie nalezy do zakresu, podaj liczbe jeszcze raz\n", &wartosc);
- return wartosc;
- }
- uint16_t oblicz (uint16_t a, uint16_t b, int wybor2)
- {
- bool kontynuuj=true;
- while(kontynuuj)
- {
- printf("4.1 OR\n4.2 AND\n4.3 XOR\n");
- switch(wybor2)
- {
- case 1:
- a &= b ;
- break;
- case 2:
- a |= b;
- break;
- case 3:
- a ^= b;
- break;
- return a;
- }
- return 0;
- }
- }
- unsigned konw (uint16_t x);
- uint16_t wypisz(uint16_t a, uint16_t b, int n)
- {
- printf("Twoje dane to %f, ",n);
- }
- int main (void)
- {
- bool kontynuuj=true;
- while(kontynuuj)
- {
- for (int i=1; i<=1000000; i++)
- {
- printf("1.Wczytaj i wyswietl dane\n");
- printf("2.Oblicz sumę.\n");
- printf("3.Oblicz różnicę.\n");
- printf("4.Mnożenie\n");
- printf("0.KONIEC\n");
- int wybor;
- float a,b,wynik;
- printf("PODAJ LICZBĘ:");
- scanf("%f", &a);
- printf("PODAJ DRUGĄ LICZBĘ:");
- scanf("%f", &b);
- printf("Jakie działanie chcesz wykonać?\n");
- scanf("%d", &wybor);
- switch(wybor)
- {
- case 1:
- wczytaj(0,100000)
- ;
- case 2:
- wynik=a+b;
- printf("Wybrałeś dodawanie, jego wynik to:%f\n", wynik);
- break;
- case 3:
- wynik=a-b;
- printf("Wybrałeś odejmowanie, jego wynik to:%f\n,",wynik);
- break;
- case 4:
- wynik=a*b;
- printf("Wybrałeś mnozenie, jego wynik to:%f\n",wynik);
- break;
- case 5:
- oblicz(a,b,wybor);
- case 0:
- kontynuuj= false;
- }
- return 0;
- }}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement