Advertisement
Guest User

Untitled

a guest
Aug 1st, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #include<string>
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4.  
  5. using namespace std;
  6.  
  7. float pay,price,dis,change,sale;
  8. char username[30];
  9. char password[30];
  10.  
  11.  
  12. int main(){
  13. string ch_username="Cashier01",ch_password="adminadmin";
  14. printf("\t\t---stree shop---\n\n");
  15. printf("please login...");
  16. printf("\nusername:");
  17. scanf("%s",&username);
  18. printf("password:");
  19. scanf("%s",&password);
  20.  
  21.  
  22. if(username==ch_username&&password==ch_password){
  23. printf("\nHi Cashier01");
  24. printf("\nplease insert price:");
  25. scanf("%f",&price);
  26.  
  27. printf("please insert pay:");
  28. scanf("%f",&pay);
  29.  
  30. if(price>=1000){
  31. dis=(price/100)*5;
  32. sale=pay-dis;
  33. change=pay-sale;
  34. printf("customer got 5%% discount as %0.2f",dis);printf("Bath");
  35. printf("\nprice after discount is %0.02f",sale);printf("Bath");
  36. printf("\nplease change %0.02f",change);printf("Bath");
  37. }
  38. else{
  39. change=pay-price;
  40. }
  41. }
  42. printf("\n Wrong username or password\n");
  43. system("pause");
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement