U E D R , A S I H C RSS

데블스캠프2006/화요일/pointer/문제4/정승희

~cpp
#include<iostream>
#include<cstring>//문자열을 비교하는 함수(strcmp)를 포함
using namespace std;
void main()
{
	char buf[64]={0,};
	cin>>buf;
	int length=strlen(buf);//길이가 저장됨.
	
	char*b=new char[length+1];

	for(int i=(length-1);i>=0;i--)
	{
		b[(length-1)-i]=buf[i];
	}

	b[length]='\0';//NULL문자는 문자 집어넣고 바로 다음에 넣는거다.

	cout<< b <<endl;

	if(strcmp(buf, b) == 0)
	{
		cout<<"T"<<endl;
	}
	else
	{
		cout<<"F"<<endl;
	}


}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:07
Processing time 0.0075 sec