asmodeus94

stringNaLiczbe

Mar 5th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <string>
  4. using namespace std;
  5. string tab[101];
  6. string liczbS[4];
  7. int main(){
  8. string liczbaT;
  9. getline(cin,liczbaT);
  10. tab[1]="jeden";
  11. tab[2]="dwa";
  12. tab[3]="trzy";
  13. tab[4]="cztery";
  14. tab[5]="piec";
  15. tab[6]="szesc";
  16. tab[7]="siedem";
  17. tab[8]="osiem";
  18. tab[9]="dziewiec";
  19. tab[11]="jedenascie";
  20. tab[12]="dwanascie";
  21. tab[13]="trzynascie";
  22. tab[14]="czternascie";
  23. tab[15]="pietnascie";
  24. tab[16]="szesnascie";
  25. tab[17]="siedemnascie";
  26. tab[18]="osiemnascie";
  27. tab[19]="dziewietnascie";
  28. tab[10]="dziesiec";
  29. tab[20]="dwadziescia";
  30. tab[30]="trzydziesci";
  31. tab[40]="czterdziesci";
  32. tab[50]="piecdziesiat";
  33. tab[60]="szescdziesiat";
  34. tab[70]="siedemdziesiat";
  35. tab[80]="osiemdziesiat";
  36. tab[90]="dziewiecdziesiat";
  37. tab[100]="sto";
  38.  
  39. int j=1;
  40. liczbS[1].clear();
  41. liczbS[2].clear();
  42. liczbS[3].clear();
  43. for(int i=0;i<=liczbaT.length();i++){
  44.         if(liczbaT[i]!=32) liczbS[j]+=liczbaT[i]; else j++;
  45. }
  46. if(j==1) liczbS[1]=liczbS[1].substr(0,liczbS[1].length()-1);
  47. if(j==2) liczbS[2]=liczbS[2].substr(0,liczbS[2].length()-1);
  48. liczbS[3]=liczbS[3].substr(0,liczbS[3].length()-1);
  49. cout<<liczbS[1]<<"*"<<endl;
  50. cout<<liczbS[2]<<"*"<<endl;
  51. cout<<liczbS[3]<<"*";
  52. system("pause");
  53. int ele=j,aEle;
  54. int i,war=0;
  55. for(aEle=1;aEle<4;aEle++){
  56.     for(i=1;i<101;i++){
  57.        if((liczbS[aEle]==tab[i])&&((tab[i].length())>0)){cout<<i<<endl;war+=i;}
  58.     }
  59. }
  60. cout<<war;
  61. system("pause>null");
  62. }
Advertisement
Add Comment
Please, Sign In to add comment