U E D R , A S I H C RSS

단어순서/방선희


세환이랑 페어하다가 하는 방법을 대충 알고..흐흐 -ㅁ-; 100% 자체코딩은 아니지만..^^;


~cpp 
#include <iostream> 
#include <cstring> 
#include <cmath> 
using namespace std; 
const int Max=20; 

void main() 
{ 
        char input[Max]; 
        cout << "문자를 입력하세요.:" ; 
        cin.get(input, Max); 
		
		int temp;
		int content = 1;
        for(int i=0;  i < strlen(input); i++)
		{
			temp = input[i] - 'a';
			content += temp * pow(strlen(input), strlen(input)-1-i);
		}
		
		cout << input << "은 " << content << "번 째 단어입니다.\n";
		
} 
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:55
Processing time 0.0122 sec