Advertisement
mashlukashova

Untitled

Apr 12th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include "Header.h"
  2. #include "SLOVO.cpp"
  3. using namespace std;
  4.  
  5.  
  6.  
  7. int Slovo::summa()
  8. {
  9. sum = 0;
  10. int n;
  11. n = slovo.length();
  12. for (int i = 0; i < n; i++){
  13. sum += (int)slovo[i];
  14. //cout <<"-";
  15. // cout << sum << endl;
  16. }
  17. // cout << sum ;
  18. return (sum);
  19. }
  20.  
  21. int Slovo::zamena(){
  22. int m, k;
  23. m = slovo.length();
  24. k = str2.length();
  25. for (int i = 0; i < m; i++){
  26. for (int j = 0; j < m; j++){
  27. if (i != j)continue;
  28. slovo[i] = (int)slovo[i] - 32;
  29. str2[j] = (char)slovo[i];
  30. cout << str2[j];
  31.  
  32. }
  33. }
  34. cout << endl;
  35.  
  36. return 0;
  37. }
  38.  
  39.  
  40. void Slovo::set()
  41. {
  42. cout << "vvedite slovo: ";
  43. cin >> slovo;
  44. cout << "---------------------------------------------------" << endl;
  45. cout << endl;
  46. }
  47.  
  48. void Slovo::show()
  49. {
  50. cout << "summa: " << summa() << endl << endl;
  51. cout << "slovo posle zameni: " << zamena() << "\n" << endl;
  52. }
  53.  
  54.  
  55. int main()
  56. {
  57. Slovo n1;
  58. n1.set();
  59. n1.show();
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement