Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include<stdio.h>
  3. #include <iostream>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. const int N = 80;
  9. int main()
  10. {
  11.  
  12. //string s="";
  13. //string s1 = "";
  14. //string s2 = "";
  15. // String res ="";
  16. //Console.WriteLine(s);
  17.  
  18. char s[N];
  19. //getline(cin, s);
  20. fgets(s, sizeof(s), stdin);
  21.  
  22. char a='3';
  23.  
  24. // cin.get >>a;
  25. //scanf("%d", &a);
  26. // Console.WriteLine(a);
  27. char b = ' ';
  28. int t = 0;
  29. int j = 0;
  30. for (int i = 0; i < N; i++)
  31. {
  32. j = j + 1;
  33. if (s[i] == '\0')
  34. {
  35. break;
  36. }
  37. }
  38.  
  39. char *res = new char[j];
  40. char *res1 = new char[j];
  41.  
  42. /*for (int i = 0; i<j; i++)
  43. {
  44. res[i] = s[i];
  45. }
  46. */
  47. for (int i = 0; i<j; i++)
  48. {
  49.  
  50. if (s[i] == a)
  51. {
  52. t = i;
  53. }
  54. // Console.Write(res[i]);
  55. }
  56. for (int i = 0; i<t; i++)
  57. {
  58. res[i] = s[i];
  59. cout << res[i];
  60. }
  61. cout << endl;
  62. for (int i = t + 1; i<j; i++)
  63. {
  64. res1[i] = s[i];
  65. cout << res1[i];
  66. }
  67.  
  68. system("pause");
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement