~cpp

#include <iostream>
using namespace std;

void main()
{

	char buf[64] = {0, };
	char reverse[64];
	int i;
	

	cin >> buf;

	int length = strlen(buf);
	
	for(i=0; i<length ; i++){
		reverse[(length-1)-i] = buf[i];
	}
	reverse[length] = '\0';

	cout <<reverse << endl;

	for(i=0; i<length; i++){

		if(reverse[i] == buf[i]){
		}

		else{
			cout << "false" << endl;
			return ;
		}
	}
	cout << " true " <<endl;
}

	
Retrieved from http://wiki.zeropage.org/wiki.php/데블스캠프2006/화요일/pointer/문제4/이장길
last modified 2021-02-07 05:29:07