Advertisement
Guest User

Untitled

a guest
Jan 6th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <windows.h>
  5.  
  6. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  7. int Login(char true_username[5]);
  8. int Password(char true1_username[5],char true_password[5],int a);
  9. void Add();
  10. void Modify();
  11. void View();
  12. void Search();
  13. void Sort();
  14. void Exit();
  15. char *Array[100][3];
  16. int u = 0;
  17. int main(int argc, char *argv[]) {
  18.     int x;
  19.     int a=0+rand()%1;
  20.     char Anwser[7];
  21.     char true_password[5];
  22.     char true_username[5] = "John";
  23.     do
  24.     {
  25.         x = Login(true_username);
  26.     }while(x != 0);
  27.     Password(true_username,true_password,a);
  28.     printf("Please enter one of the following words(Add,Modify,View,Search,Sort or Exit):\n");
  29.     scanf("%s",&Anwser);
  30.     if(strcmp(Anwser,"Add") == 0){
  31.         Add();    
  32.     }
  33.     else if(strcmp(Anwser,"Modify") == 0){
  34.        
  35.     }
  36.     else if(strcmp(Anwser,"View") == 0){
  37.        
  38.     }
  39.     else if(strcmp(Anwser,"Search") == 0){
  40.        
  41.        
  42.     }
  43.     else if(strcmp(Anwser,"Sort") == 0){
  44.        
  45.     }
  46.     else if(strcmp(Anwser,"Exit") == 0){
  47.        
  48.     }
  49.  
  50.  
  51.  
  52.     return 0;
  53. }
  54. int Login(char true_username[5]){
  55.     char username[5];
  56.     printf("Please enter your username:\n");
  57.     scanf("%s",&username);
  58.     if(strcmp(true_username,username) == 0){
  59.         return 0;
  60.     }
  61.     else if(strcmp(true_username,username) != 0){
  62.         return 1;
  63.     }
  64. }
  65. int Password(char true1_username[5],char true_password[5],int a){
  66.     char password[5];
  67.     if(a == 0){
  68.     true1_username[0] = 'J';
  69.     true1_username[2] = 'H';}
  70.     else if(a == 1){
  71.     true1_username[1] = 'O';
  72.     true1_username[3] = 'N';}
  73.     true_password = true1_username;
  74.         do
  75.     {
  76.         printf("Please enter your password:\n");
  77.         scanf("%s",&password);
  78.     }while(strcmp(password,true_password) != 0);
  79.  
  80.     return 0;
  81. }
  82. void Add(){
  83.     system("cls");
  84.     char i;
  85.     int sum;
  86.     float wra;
  87.     int ther;
  88.    
  89.     printf("Enter meal\n");
  90.     scanf("%s",&Array[u][0]);
  91.     printf("Enter calories\n");
  92.     scanf("%d", &ther);
  93.  sum=sum+ther;
  94.  char c = (char) ther;
  95. Array[u][1]='c';
  96.  printf("enter time\n");
  97. scanf("%f", &wra );
  98. i = (char) wra;
  99. Array[u][2]='i';
  100. if(wra>=05.00 && wra<12.00){
  101.    Array[u][3]= "prwino";
  102. }
  103. else if(wra>=12.00 && wra<20.00){
  104.     Array[u][3] = "mesimeriano";
  105. }
  106. else if(wra>=20.00 && wra<05.00){
  107.     Array[u][3] = "vradino";
  108. }
  109. u++;
  110.    
  111. }
  112.  
  113.  
  114. void Modify(){
  115.    
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement