Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <windows.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int Login(char true_username[5]);
- int Password(char true1_username[5],char true_password[5],int a);
- void Add();
- void Modify();
- void View();
- void Search();
- void Sort();
- void Exit();
- char *Array[100][3];
- int u = 0;
- int main(int argc, char *argv[]) {
- int x;
- int a=0+rand()%1;
- char Anwser[7];
- char true_password[5];
- char true_username[5] = "John";
- do
- {
- x = Login(true_username);
- }while(x != 0);
- Password(true_username,true_password,a);
- printf("Please enter one of the following words(Add,Modify,View,Search,Sort or Exit):\n");
- scanf("%s",&Anwser);
- if(strcmp(Anwser,"Add") == 0){
- Add();
- }
- else if(strcmp(Anwser,"Modify") == 0){
- }
- else if(strcmp(Anwser,"View") == 0){
- }
- else if(strcmp(Anwser,"Search") == 0){
- }
- else if(strcmp(Anwser,"Sort") == 0){
- }
- else if(strcmp(Anwser,"Exit") == 0){
- }
- return 0;
- }
- int Login(char true_username[5]){
- char username[5];
- printf("Please enter your username:\n");
- scanf("%s",&username);
- if(strcmp(true_username,username) == 0){
- return 0;
- }
- else if(strcmp(true_username,username) != 0){
- return 1;
- }
- }
- int Password(char true1_username[5],char true_password[5],int a){
- char password[5];
- if(a == 0){
- true1_username[0] = 'J';
- true1_username[2] = 'H';}
- else if(a == 1){
- true1_username[1] = 'O';
- true1_username[3] = 'N';}
- true_password = true1_username;
- do
- {
- printf("Please enter your password:\n");
- scanf("%s",&password);
- }while(strcmp(password,true_password) != 0);
- return 0;
- }
- void Add(){
- system("cls");
- char i;
- int sum;
- float wra;
- int ther;
- printf("Enter meal\n");
- scanf("%s",&Array[u][0]);
- printf("Enter calories\n");
- scanf("%d", &ther);
- sum=sum+ther;
- char c = (char) ther;
- Array[u][1]='c';
- printf("enter time\n");
- scanf("%f", &wra );
- i = (char) wra;
- Array[u][2]='i';
- if(wra>=05.00 && wra<12.00){
- Array[u][3]= "prwino";
- }
- else if(wra>=12.00 && wra<20.00){
- Array[u][3] = "mesimeriano";
- }
- else if(wra>=20.00 && wra<05.00){
- Array[u][3] = "vradino";
- }
- u++;
- }
- void Modify(){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement