Guest User

Untitled

a guest
Jul 31st, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 20.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int mainmenu(int y)
  5.  
  6. {
  7.     int c;
  8.     char username1[50], password1[50];
  9.     FILE*database;
  10.  
  11.     struct user
  12.     {
  13.         char student_ID[50], course[50], email[50], sem[50],name[50];
  14.         int age;
  15.     };
  16.     struct user s;
  17.     if(y==1)
  18.     {
  19.  
  20.  
  21.     database=fopen("database.dat","a");
  22.     system("cls");
  23.     printf("\t\t\t\t==============\n");
  24.     printf("\t\t\t\tTHERMO COMPANY\n");
  25.     printf("\t\t\t\t==============\n");
  26.  
  27.     printf("\n\n\t\tPlease complete the registration form neatly. Thanks!\n");
  28.  
  29.     printf("\n\n\tUsername: ");
  30.     gets(username1);
  31.     fgets(username1,50,stdin);
  32.     fprintf(database,"\nUsername:\t%s", username1);
  33.  
  34.     printf("\n\tPassword: ");
  35.     fgets(password1,50,stdin);
  36.     fprintf(database,"Password:\t%s", password1);
  37.  
  38.     printf("\n\tName: ");
  39.     fgets(s.name,50,stdin);
  40.     fprintf(database,"Name:\t%s", s.name);
  41.  
  42.     printf("\n\tAge: ");
  43.     scanf("%d", &s.age);
  44.     fprintf(database,"Age:\t%d", s.age);
  45.  
  46.     gets(s.student_ID);
  47.     printf("\n\tStudent ID: ");
  48.     fgets(s.student_ID,50,stdin);
  49.     fprintf(database,"Studen ID:\t%s", s.student_ID);
  50.  
  51.     printf("\n\tCourse: ");
  52.     fgets(s.course,50,stdin);
  53.     fprintf(database,"Course:\t%s", s.course);
  54.  
  55.     printf("\n\tSemester: ");
  56.     fgets(s.sem,50,stdin);
  57.     fprintf(database,"Semester:\t%s", s.sem);
  58.  
  59.     printf("\n\tE-Mail: ");
  60.     fgets(s.email,50,stdin);
  61.     fprintf(database,"E-Mail:\t%s", s.email);
  62.  
  63.     fclose(database);
  64.     printf("\n\n\tYou have succesfully register.");
  65.     printf("\n\n\tPress any key to continue login...");
  66.     getch();
  67.     goto login;
  68.  
  69.  
  70.     }
  71.     else if(y==2)
  72.     {
  73.         char username[50], password[50],attempt, attempt1;
  74.         login:
  75.         system("cls");
  76.         printf("\t\t\t\t==============\n");
  77.         printf("\t\t\t\tTHERMO COMPANY\n");
  78.         printf("\t\t\t\t==============\n");
  79.         printf("\n\t\t\tEnter your username and password:\n");
  80.         printf("\n\t\t\tUsername:\t");
  81.         scanf("%s", &username);
  82.         printf("\n\t\t\tPassword:\t");
  83.         scanf("%s", &password);
  84.  
  85.         attempt=strcmp(password,password1);
  86.         attempt1=strcmp(username,username1);
  87.  
  88.         if(attempt==0&&attempt1==0)
  89.         {
  90.             system("cls");
  91.             printf("\t\t\t\t==============\n");
  92.             printf("\t\t\t\tTHERMO COMPANY\n");
  93.             printf("\t\t\t\t==============\n");
  94.             printf("\t\t\t\tLogin Successfully!\n");
  95.             printf("\t\t\t\tPress enter to continue...");
  96.             getch();
  97.             homepage();
  98.  
  99.         }
  100.         else
  101.         {
  102.             system("cls");
  103.             printf("\t\t\t\t==============\n");
  104.             printf("\t\t\t\tTHERMO COMPANY\n");
  105.             printf("\t\t\t\t==============\n");
  106.  
  107.             printf("\n\n\tEither your name or your login id is wrong.\n\n\tIf you did not register yet please do it so at the main menu.");
  108.             printf("\n\n\tPress 1 to try again and 2 to go back to the main menu.");
  109.             printf("\n\n\tElse to exit.");
  110.             scanf("%d", &c);
  111.  
  112.             if(c==1)
  113.             {
  114.                 system("cls");
  115.                 goto login;
  116.             }
  117.             if(c==2)
  118.             {
  119.                 system("cls");
  120.                 main();
  121.             }
  122.  
  123.             else
  124.             {
  125.                 return 0;
  126.             }
  127.  
  128.         }
  129.     }
  130.     else if(y==3)
  131.     {
  132.         exit:
  133.         system("cls");
  134.         printf("\t\t\t\t==============\n");
  135.         printf("\t\t\t\tTHERMO COMPANY\n");
  136.         printf("\t\t\t\t==============\n");
  137.  
  138.         printf("\a\n\t\t\tThanks for using this programme.\n\n\n\n\n\n\n\n");
  139.         return 0;
  140.     }
  141.     else if(y==4)
  142.     {
  143.         homepage();    }
  144.     else
  145.     {
  146.         system("cls");
  147.         printf("\t\t\t\t==============\n");
  148.         printf("\t\t\t\tTHERMO COMPANY\n");
  149.         printf("\t\t\t\t==============\n");
  150.         printf("\n\t\t\t\tInvalid input.");
  151.         printf("\n\n\t\tPress 1 to go back and others key to close: ");
  152.         scanf("%d", &y);
  153.  
  154.         if(y==1)
  155.         {
  156.             main();
  157.         }
  158.         else
  159.         {
  160.             goto exit;
  161.         }
  162.         return 0;
  163. }
  164.         return 0;
  165.  
  166. }
  167.  
  168. int homepage()
  169. {
  170.     FILE*registration;
  171.     char ch,opt3;
  172.     int i,opt=0;
  173.     int option, options,x,z;
  174.     float HE, R, HP, CHE, CR, CHP, work, Qin, Qout, Thigh, Tlow;
  175.     homepage:
  176.     system("cls");
  177.     printf("\t\t\t\t==============\n");
  178.     printf("\t\t\t\tTHERMO COMPANY\n");
  179.     printf("\t\t\t\t==============\n\n\n");
  180.  
  181.     printf("\t_____________________________________________________\n");
  182.     printf("\n\tA. Second Law of Thermodynamics\t\tE. My Profile \n");
  183.     printf("\n\tB. General Energy Analysisis\t\tF. Log Out\n");
  184.     printf("\n\tC. Properties of Pure Substance\t\tG. About Us\n");
  185.     printf("\n\tD. Energy Analysis of Control Volume\tH. Exit\n");
  186.     printf("\n\tEnter Your Selection: ");
  187.  
  188.     fflush(stdin);
  189.     scanf("%c", &opt3);
  190.  
  191.     switch(opt3)
  192.     {
  193.         aiman:
  194.         case 'a':case 'A':
  195.         system("cls");
  196.         printf("\t\t\t\t==============\n");
  197.         printf("\t\t\t\tTHERMO COMPANY\n");
  198.         printf("\t\t\t\t==============\n");
  199.  
  200.         printf("\n\t--------Welcome to The Second Law of Thermodynamics--------\n\n");
  201.     printf("\tPlease choose the following options below\n");
  202.     printf("\t1.  Heat Engine\n");
  203.     printf("\t2.  Refrigerators\n");
  204.     printf("\t3.  Heat Pumps\n");
  205.     printf("\t4.  Carnot Heat Engine\n");
  206.     printf("\t5.  Carnot Refrigerators\n");
  207.     printf("\t6.  Carnot Heat Pump\n");
  208.     printf("\t7.  Main Menu.\n\n");
  209.     printf("\tEnter Selection : ");
  210.     scanf("%d", &option);
  211.  
  212.     if(option == 1)
  213.     {
  214.         system("cls");
  215.         printf("\t\t\t\t==============\n");
  216.         printf("\t\t\t\tTHERMO COMPANY\n");
  217.         printf("\t\t\t\t==============\n");
  218.  
  219.         printf("\n\tThis program will calculate the thermal efficiency of Heat Engine\n");
  220.         printf("\n\tPlease choose which formula you will use:\n\n");
  221.         printf("1.   First Formula(use when value of Work and Heat Enter are given in system)\n");
  222.         printf("2.   Second Formula(use when value of Heat Enter and Heat Out are given in\n     system)\n");
  223.         printf("\n\tSelection:  ");
  224.         scanf("%d", &options);
  225.  
  226.         if(options == 1)
  227.         {
  228.             printf("\n\tPlease enter the value of Work : ");
  229.             scanf("%f", &work);
  230.             printf("\n\tPlease enter the value of Heat Enter : ");
  231.             scanf("%f", &Qin);
  232.  
  233.             HE = work/Qin;
  234.  
  235.             printf("\n\tThe value of your Thermal Efficiency is %.4f\n", HE);
  236.             printf("\n\n\tPress Enter to continue...");
  237.             getch();
  238.             goto aiman;
  239.         }
  240.  
  241.         else if(options == 2)
  242.         {
  243.             printf("\n\tPlease enter the value of Heat Enter :");
  244.             scanf("%f", &Qin);
  245.             printf("\n\tPlease enter the value of Heat Out :");
  246.             scanf("%f", &Qout);
  247.  
  248.             HE = 1 - (Qout/Qin);
  249.  
  250.             printf("\n\tThe value of Thermal Efficiency is %.4f\n", HE);
  251.             printf("\n\n\tPress Enter to continue...");
  252.             getch();
  253.             goto aiman;
  254.         }
  255.         else
  256.         {
  257.             system("cls");
  258.         printf("\t\t\t\t==============\n");
  259.         printf("\t\t\t\tTHERMO COMPANY\n");
  260.         printf("\t\t\t\t==============\n");
  261.         printf("\n\n\tPress Enter to continue...");
  262.             getch();
  263.             goto aiman;
  264.         }
  265.     }
  266.  
  267.     else if(option == 2)
  268.     {
  269.         system("cls");
  270.         printf("\t\t\t\t==============\n");
  271.         printf("\t\t\t\tTHERMO COMPANY\n");
  272.         printf("\t\t\t\t==============\n");
  273.         printf("\n\t     This program will calculate the Coefficient of Perfomance\n\t\t\t\tof Refrigerators\n");
  274.         printf("\n\tPlease choose which formula you will use\n\n");
  275.         printf("1.   First Formula(use when value of Work and Heat Out are given in system)\n");
  276.         printf("2.   Second Formula(use when value of Heat Enter and Heat Out are given in\n     system)\n");
  277.         printf("\n\tSelection: ");
  278.         scanf("%d", &options);
  279.  
  280.         if(options == 1)
  281.         {
  282.             printf("\n\n\tPlease enter the value of Work : ");
  283.             scanf("%f", &work);
  284.             printf("\n\tPlease enter the value of Heat Enter : ");
  285.             scanf("%f", &Qout);
  286.  
  287.             R = Qout/work;
  288.  
  289.             printf("\n\tThe value of the Coefficient of Perfomance is %.4f\n", R);
  290.             printf("\n\n\tPress Enter to continue...");
  291.             getch();
  292.             goto aiman;
  293.  
  294.         }
  295.  
  296.         else if(options == 2)
  297.         {
  298.             printf("\n\n\tPlease enter the value of Heat Enter : ");
  299.             scanf("%f", &Qin);
  300.             printf("\n\tPlease enter the value of Heat Out : ");
  301.             scanf("%f", &Qout);
  302.  
  303.             R = Qout/( Qin - Qout);
  304.  
  305.             printf("\n\tThe value of the Coefficient of Perfomance is %.4f\n", R);
  306.             printf("\n\n\tPress Enter to continue...");
  307.             getch();
  308.             goto aiman;
  309.  
  310.         }
  311.  
  312.         else
  313.         {
  314.             system("cls");
  315.         printf("\t\t\t\t==============\n");
  316.         printf("\t\t\t\tTHERMO COMPANY\n");
  317.         printf("\t\t\t\t==============\n");
  318.         printf("\n\n\tPress Enter to continue...");
  319.             getch();
  320.             goto aiman;
  321.  
  322.         }
  323.     }
  324.  
  325.     else if(option == 3)
  326.     {
  327.         system("cls");
  328.         printf("\t\t\t\t==============\n");
  329.         printf("\t\t\t\tTHERMO COMPANY\n");
  330.         printf("\t\t\t\t==============\n");
  331.  
  332.         printf("\n\n\t\tThis program will calculate the Coefficient\n\t\t\tof Perfomance of Heat Pumps\n");
  333.         printf("\n\tPlease choose which formula you will use\n");
  334.         printf("\n1.   First Formula(use when value of Work and Heat Enter are given in system)\n");
  335.         printf("2.   Second Formula(use when value of Heat Enter and Heat Out are given in\n     system)\n");
  336.         printf("\n\n\tSelection: ");
  337.         scanf("%d", &options);
  338.  
  339.         if(options == 1)
  340.         {
  341.             printf("\n\tPlease enter the value of Work :");
  342.             scanf("%f", &work);
  343.             printf("\n\tPlease enter the value of Heat Enter :");
  344.             scanf("%f", &Qin);
  345.  
  346.             HP = Qin/work;
  347.  
  348.             printf("\n\tThe value of the Coefficient of Perfomance is %.4f\n", HP);
  349.             printf("\n\n\tPress Enter to continue...");
  350.             getch();
  351.             goto aiman;
  352.  
  353.         }
  354.  
  355.         else if(options == 2)
  356.         {
  357.             printf("\n\tPlease enter the value of Heat Enter :");
  358.             scanf("%f", &Qin);
  359.             printf("\n\tPlease enter the value of Heat Out :");
  360.             scanf("%f", &Qout);
  361.  
  362.             HP = Qin/( Qin - Qout);
  363.  
  364.             printf("\n\tThe value of the Coefficient of Perfomance is %.4f\n", HP);
  365.             printf("\n\n\tPress Enter to continue...");
  366.             getch();
  367.             goto aiman;
  368.  
  369.  
  370.         }
  371.  
  372.         else
  373.         {
  374.             system("cls");
  375.             printf("\t\t\t\t==============\n");
  376.             printf("\t\t\t\tTHERMO COMPANY\n");
  377.             printf("\t\t\t\t==============\n");
  378.  
  379.  
  380.  
  381.             printf("\n\n\tPress Enter to continue...");
  382.             getch();
  383.             goto aiman;
  384.  
  385.         }
  386.     }
  387.  
  388.     else if(option == 4)
  389.     {
  390.         system("cls");
  391.         printf("\t\t\t\t==============\n");
  392.         printf("\t\t\t\tTHERMO COMPANY\n");
  393.         printf("\t\t\t\t==============\n");
  394.         printf("\n\t\tThis program will calculate the Thermal Efficiency\n\t\t\t     of Carnot Heat Engine\n");
  395.         printf("\n\tPlease enter the value of High Temperature :");
  396.         scanf("%f", &Thigh);
  397.         printf("\n\tPlease enter the value of Low Temperature :");
  398.         scanf("%f", &Tlow);
  399.  
  400.         CHE = 1 - ( Tlow / Thigh);
  401.  
  402.         printf("\n\n\tThe value of Thermal Efficiency is %.4f\n", CHE);
  403.         printf("\n\n\tPress Enter to continue...");
  404.             getch();
  405.             goto aiman;
  406.     }
  407.  
  408.     else if(option == 5)
  409.     {
  410.         system("cls");
  411.         printf("\t\t\t\t==============\n");
  412.         printf("\t\t\t\tTHERMO COMPANY\n");
  413.         printf("\t\t\t\t==============\n");
  414.  
  415.         printf("\n\n\t\tThis program will calculate the Coefficient\n\t\t  of Perfomance of Carnot Refrigerators\n");
  416.         printf("\n\tPlease enter the value of High Temperature : ");
  417.         scanf("%f", &Thigh);
  418.         printf("\n\tPlease enter the value of Low Temperature : ");
  419.         scanf("%f", &Tlow);
  420.  
  421.         CR = Tlow / (Thigh - Tlow);
  422.  
  423.         printf("\n\n\tThe value of Coefficient of Perfomance is %.4f\n", CR);
  424.         printf("\n\n\tPress Enter to continue...");
  425.             getch();
  426.             goto aiman;
  427.  
  428.     }
  429.  
  430.     else if(option == 6)
  431.     {
  432.         system("cls");
  433.         printf("\t\t\t\t==============\n");
  434.         printf("\t\t\t\tTHERMO COMPANY\n");
  435.         printf("\t\t\t\t==============\n");
  436.  
  437.         printf("\n\n\tThis program will calculate the Coefficient of Perfomance of Heat Pumps\n");
  438.         printf("\nPlease enter the value of High Temperature :\n");
  439.         scanf("%f", &Thigh);
  440.         printf("\nPlease enter the value of Low Temperature :\n");
  441.         scanf("%f", &Tlow);
  442.  
  443.         CHP = Thigh / (Thigh - Tlow);
  444.  
  445.         printf("The value of Thermal Efficiency is %.4f\n", CHP);
  446.         getch();
  447.         goto aiman;
  448.     }
  449.  
  450.     if(option==7)
  451.     {
  452.         goto homepage;
  453.     }
  454.  
  455.     else
  456.     {
  457.         system("cls");
  458.         printf("\t\t\t\t==============\n");
  459.         printf("\t\t\t\tTHERMO COMPANY\n");
  460.         printf("\t\t\t\t==============\n");
  461.  
  462.  
  463.             printf("\n\n\tInvalid input...");
  464.             printf("\n\n\tPress Enter to continue...");
  465.             getch();
  466.             goto aiman;
  467.  
  468.     }
  469.  
  470.  
  471.         break;
  472.  
  473.         case 'b':case 'B':
  474.         system("cls");
  475.         printf("\t\t\t\t==============\n");
  476.         printf("\t\t\t\tTHERMO COMPANY\n");
  477.         printf("\t\t\t\t==============\n");
  478.         printf("\n\n\t\t\tENERGY TRANSFER OF CLOSED SYSTEM");
  479.         printf("\n\t\t\t________________________________");
  480.  
  481.     while(opt!=4)
  482.     {
  483.         printf("\n\n\tPlease select:\n");
  484.         printf("\n\t1. Potential Energy");
  485.         printf("\n\t2. Kinetic Energy");
  486.         printf("\n\t3. Energy Trasfer");
  487.         printf("\n\t4. Quit\n\t:");
  488.         scanf("%d", &opt);
  489.  
  490.         if(opt==1)
  491.         {
  492.             potential_energy();
  493.         }
  494.         else if(opt==2)
  495.         {
  496.             kinetic_energy();
  497.         }
  498.         else if(opt==3)
  499.         {
  500.             energy_transfer();
  501.         }
  502.         else{goto homepage;}
  503.  
  504.     }
  505. return 0;
  506.         break;
  507.  
  508.         case 'c': case 'C':
  509.         system("cls");
  510.         printf("\t\t\t\t==============\n");
  511.         printf("\t\t\t\tTHERMO COMPANY\n");
  512.         printf("\t\t\t\t==============\n");
  513.         printf("\n\n\t\t\tENERGY ANALYSIS OF CONTROL VOLUME");
  514.         printf("\n\t\t\t________________________________");
  515.  
  516.     while(opt!=3)
  517.     {
  518.         printf("\n\n\tPlease select:\n");
  519.         printf("\n\t1. Quality");
  520.         printf("\n\t2. Ideal Gas EoS");
  521.         printf("\n\t3. Quit\n\t:");
  522.         scanf("%d", &opt);
  523.  
  524.         if(opt==1)
  525.         {
  526.             quality();
  527.         }
  528.         else if(opt==2)
  529.         {
  530.             ideal_gas();
  531.         }
  532.  
  533.         else
  534.         {goto homepage;}
  535.     }
  536. return 0;
  537.  
  538.         break;
  539.  
  540.         case 'd': case 'D':
  541.         system("cls");
  542.         printf("\t\t\t\t==============\n");
  543.         printf("\t\t\t\tTHERMO COMPANY\n");
  544.         printf("\t\t\t\t==============\n");
  545.         printf("\n\n\t\t\t\t    ENTROPY");
  546.         printf("\n\t\t\t\t    _______");
  547.  
  548.         break;
  549.  
  550.         case 'e': case 'E':
  551.         system("cls");
  552.         printf("\t\t\t\t==============\n");
  553.         printf("\t\t\t\tTHERMO COMPANY\n");
  554.         printf("\t\t\t\t==============\n");
  555.         registration=fopen( "database.dat","r");
  556.  
  557.         if(registration==NULL)
  558.         {
  559.             puts("\n\n\t\t     The database cannot read your profile.\n\t\tEither it is corrupted or you are not registered.");
  560.             puts("\n\n\t\tThe system will now close for safety measurements.");
  561.             break;
  562.         }
  563.         else
  564.         {
  565.             while (1)
  566.         {
  567.             ch=fgetc(registration);
  568.             if(ch==EOF)
  569.             break ;
  570.             printf ( "%c", ch);
  571.         }
  572.             fclose(registration);
  573.  
  574.         }
  575.             printf("\n\nPress Enter to continue...");
  576.             getch();
  577.             goto homepage;
  578.  
  579.             break;
  580.  
  581.         case 'f': case 'F':
  582.         system("cls");
  583.         printf("\t\t\t\t==============\n");
  584.         printf("\t\t\t\tTHERMO COMPANY\n");
  585.         printf("\t\t\t\t==============\n");
  586.         printf("\n\n\t\t\t\t>>>>Logout<<<<");
  587.         getch();
  588.         main();
  589.         break;
  590.  
  591.         case 'g': case 'G':
  592.         system("cls");
  593.         printf("\t\t\t\t==============\n");
  594.         printf("\t\t\t\tTHERMO COMPANY\n");
  595.         printf("\t\t\t\t==============\n\n\n");
  596.         printf("\n\n\tThe mission of Thermo Company is to develop and supply");
  597.         printf("\n\tsuperior software, databases and services for technical  ");
  598.         printf("\n\tcalculations involving thermodynamics or thermal calculations.\n");
  599.         printf("\n\tThermo Company continuously develops our software and");
  600.         printf("\n\tdatabases in order to create new and better tools for\n\tsuch calculations.");
  601.         printf("\n\n\tPress 1 to exit, else to go back: ");
  602.         scanf("%d", &z);
  603.         switch(z)
  604.         {
  605.             case 1: goto exit;
  606.                     break;
  607.  
  608.             default:
  609.                     goto homepage;
  610.                     break;
  611.         }
  612.         break;
  613.  
  614.  
  615.         case 'h': case 'H':
  616.         system("cls");
  617.         exit:
  618.         system("cls");
  619.         printf("\t\t\t\t==============\n");
  620.         printf("\t\t\t\tTHERMO COMPANY\n");
  621.         printf("\t\t\t\t==============\n");
  622.  
  623.         printf("\a\n\t\t\tThanks for using this programme.\n\n\n\n\n\n\n\n");
  624.         break;
  625.  
  626.         default:
  627.  
  628.         system("cls");
  629.         printf("\t\t\t\t==============\n");
  630.         printf("\t\t\t\tTHERMO COMPANY\n");
  631.         printf("\t\t\t\t==============\n");
  632.         printf("\n\t\t\t\tInvalid input.");
  633.         printf("\n\n\t\tPress 1 to go back and others key to close: ");
  634.         scanf("%d", &x);
  635.  
  636.         if(x==1)
  637.         {
  638.             goto homepage;
  639.         }
  640.         else
  641.         {
  642.             goto exit;
  643.         }
  644.         break;
  645.     }
  646. }
  647. energy_transfer()
  648. {
  649.     float energy_transfer,heat_transfer, work_transfer, mass_flow;
  650.     printf("\nEnter heat transfer :");
  651.     scanf("%f", &heat_transfer);
  652.     printf("\nEnter work transfer :");
  653.     scanf("%f", &work_transfer);
  654.     printf("\nEnter mass flow :");
  655.     scanf("%f", &mass_flow);
  656.     energy_transfer = heat_transfer + work_transfer + mass_flow;
  657.     printf("\nEnergy transfer : %.2f", energy_transfer);
  658. }
  659.  
  660. kinetic_energy()
  661. {
  662.     float kinetic_energy,mass,gravity,height;
  663.     printf("\nEnter mass (kg):");
  664.     scanf("%f", &mass);
  665.     printf("\nEnter Gravity ");
  666.     scanf("%f", &gravity);
  667.     printf("\nEnter height (m)");
  668.     scanf("%f", &height);
  669.     kinetic_energy = mass*gravity*height;
  670.     printf("\nKinetic Energy : %.2f", kinetic_energy);
  671. }
  672.  
  673. potential_energy()
  674. {
  675.     float potential_energy,mass,velocity;
  676.     printf("\nEnter mass (kg):");
  677.     scanf("%f", &mass);
  678.     printf("\nEnter velocity (m\s) :");
  679.     scanf("%f", &velocity);
  680.     potential_energy = (mass*velocity*velocity)/2;
  681.     printf("\nPotential Energy : %.2f", potential_energy);
  682. }
  683.  
  684. ideal_gas ()
  685. {
  686.     float ideal_gas, pressure, volume, mass, gas_constant,temperature;
  687.     printf("Enter pressure :");
  688.     scanf("%f", &pressure);
  689.     printf("Enter volume :");
  690.     scanf("%f", &volume);
  691.     printf("Enter mass :");
  692.     scanf("%f", &mass);
  693.     printf("Enter gas constant :");
  694.     scanf("%f", &gas_constant);
  695.     printf("Enter temperature :");
  696.     scanf("%f", &temperature);
  697.     ideal_gas = (gas_constant*mass*temperature)/(pressure*volume);
  698.     printf("Ideal gas EoS : %.2f", ideal_gas);
  699. }
  700.  
  701. quality ()
  702. {
  703.     float quality,v_f, v_average, v_fg;
  704.     printf("Enter v or v average :\n");
  705.     scanf("%f", &v_average);
  706.     printf("Enter vf :\n");
  707.     scanf("%f", &v_f);
  708.     printf("Enter vfg :");
  709.     scanf("%f", &v_fg);
  710.     quality = (v_f*v_average)/v_fg;
  711.     printf("Quality : %.2f", quality);
  712.  
  713. }
  714.  
  715.  
  716. int main()
  717. {
  718.     int opt1,y;
  719.     main:
  720.     system("cls");
  721.     printf("\t\t\t\t==============\n");
  722.     printf("\t\t\t\tTHERMO COMPANY\n");
  723.     printf("\t\t\t\t==============\n");
  724.     printf("\n\t\t\t\tWelcome Guest!\n");
  725.     printf("\n\t\t\t\t______________\n");
  726.     printf("\n\t\t\t\t1. REGISTER");
  727.     printf("\n\t\t\t\t2. LOGIN\n");
  728.     printf("\t\t\t\t3. EXIT\n");
  729.     printf("\t\t\t\t______________\n");
  730.  
  731.     printf("\n\n\t\t\t\tEnter: ");
  732.  
  733.     scanf("%d", &opt1);
  734.     mainmenu(opt1);
  735. }
Add Comment
Please, Sign In to add comment