Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. #include<iostream>
  2. #include<string.h>
  3. #include<iomanip>
  4. #include<cstdio>
  5. using namespace std;
  6. int main()
  7. {
  8. char a[30],b[30];
  9. double love;
  10. while(!cin.eof())
  11. {
  12. gets(a);
  13. gets(b);
  14. int aaa=0,bbb=0,i,aa,bb,sum1,sum2;
  15. aa=strlen(a);
  16. bb=strlen(b);
  17. for(i=0; i<aa; i++)
  18. {
  19. if(isalpha(a[i]))
  20. {
  21. if('a'<= a[i] && a[i]<='z')
  22. {
  23. aaa+=(a[i]-96);
  24. }
  25. else
  26. {
  27. aaa+=(a[i]-64);
  28. }
  29. }
  30. }
  31. for(i=0; i<bb; i++)
  32. {
  33. if(isalpha(b[i]))
  34. {
  35. if('a'<=b[i] && b[i]<='z')
  36. {
  37. bbb+=(b[i]-96);
  38. }
  39. else
  40. {
  41. bbb+=(b[i]-64);
  42. }
  43. }
  44. }
  45. aaa=((aaa-1)%9)+1;
  46. bbb=((bbb-1)%9)+1;
  47. if(aaa>=bbb)
  48. {
  49. love=((double)bbb/(double)aaa)*100;
  50. printf("%.2lf %%\n",love);
  51. }
  52. else
  53. {
  54. love=((double)aaa/(double)bbb)*100;
  55. printf("%.2lf %%\n",love);
  56. }
  57. }
  58. return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement