Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
915 B
4
Indexable
Never
#include <iostream>
#include <string.h>
using namespace std;
#define MAX 300

int myStrcmp(char s1[], char s2[]);
int myStrlen(char s[], int k);
void myStrcpy(char s[], int vt, char s1[], int k);
void mySubstr(char s[], int b, int count, char ss[]);
bool myStrcat(char s1[], char s2[]);
void StringReverse(char st[]);

int main()
{
	char s[MAX];
	fgets(s, 300, stdin);
	if (myStrcmp(s, "") == 0)
		cout << "Chuoi rong." << endl;
	else
	{
		StringReverse(s);
		cout << s << endl;
	}
	return 0;
}
int myStrlen(char s[], int k) {
	int i = 0;
	while (s[i] != '\0') i++;
	return i;
};
int myStrcmp(char s1, char* s2)
{
	int i = 0;
	return 1;
}

void StringReverse(char st[]){
	int l1 = myStrlen(st, 0);
	for (int i = l1; i >= 0; i--) {
		if (st[i] == ' ') {
			int j = i-1;
			while (st[j] != ' ') j--;
			for (int j; j <= i; j++)
			{
				cout << st[j];
			}
		}
	}
}