Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <cstring>
- using namespace std;
- char* newstr(char*temp)
- {
- int i = 0, j = 0, N;
- N = strlen(temp) + 1;
- char *str = new char[N];
- strcpy(str, temp);
- delete[]temp;
- char* fin_string = new char[N];
- while (i != N)
- {
- if (str[i] != '<')
- {
- fin_string[j] = str[i];
- i++;
- j++;
- }
- else
- {
- fin_string[j] = str[i];
- i++;
- j++;
- while (str[i] != '>')
- i++;
- fin_string[j] = str[i];
- i++;
- j++;
- delete[]str;
- }
- }
- }
- int main()
- {
- setlocale(0, "");
- cout << "Input string" << endl;
- char * temp = new char[256];
- gets(temp);
- char*fin_string = newstr(temp);
- cout << "Well done, fine human. Your new string is down here: " << endl << fin_string << endl;
- delete[]fin_string;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement