Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- enum PaperThings
- {
- Book,
- Magasine,
- NewsPaper,
- MetodichkaPoEVM,
- NoteBook
- };
- struct Rectangle
- {
- double x0, y0, x1, y1, x2, y2, x3, y3;
- };
- double getArea(struct Rectangle myRectangle) {
- return (sqrt(pow((myRectangle.x1 - myRectangle.x0), 2) +
- pow((myRectangle.y1 - myRectangle.y0),2))*sqrt(pow((myRectangle.x3 - myRectangle.x1), 2) +
- pow((myRectangle.y3 - myRectangle.y1), 2)));
- }
- struct state_bits
- {
- unsigned int reproduction : 1;
- unsigned int pause : 1;
- unsigned int record : 1;
- };
- typedef union MP3Player {
- struct state_bits bits;
- unsigned int state;
- };
- int main() {
- enum PaperThings a = NewsPaper;
- printf("%d\n", a);
- struct Rectangle square1 = { 0.0, 3.0, 4.0, 3.0, 0.0, 0.0, 4.0, 0.0 };
- printf("%f\n", getArea(square1));
- union MP3Player my_mp3;
- scanf_s("%hx", &my_mp3.state);
- if (my_mp3.bits.reproduction == 1) {
- printf("mp3 is reproducting\n");
- }
- else {
- printf("mp3 is not reproducting\n");
- }
- if (my_mp3.bits.pause == 1) {
- printf("mp3 is on pause\n");
- }
- else {
- printf("mp3 is out of pause\n");
- }
- if (my_mp3.bits.record == 1) {
- printf("mp3 is recording\n");
- }
- else {
- printf("mp3 is not recording\n");
- }
- int g;
- scanf_s("%i\n", &g);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement