답안 #9597

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
9597 2014-09-28T07:32:43 Z sior Veni, vidi, vici (kriii2_V) C++
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main()
{
	int n;
	
	char buf[100 * 101 + 1];

	scanf("%d ", &n);
	gets(buf);

	int len = strlen(buf);
	
	char first;
	char second;	
	bool isFirst = true;
	string str_ret;
	int count = 0;

	for (int i = 0; i < len; i++)
	{
		count++;
	
		if (buf[i] == ' ')
		{
			str_ret += " ";
			count = 0;
			isFirst = true;
			continue;
		}
		
		if (isFirst == true)
		{
			first = buf[i] - 'a';
			isFirst = false;
		}
		else
		{
			second = buf[i] - 'a';
			isFirst = true;
		}

		if (count % 2 == 0)
			str_ret += (char)((first + second - n + 26) % 26) + 'a';


	}

	cout << str_ret << endl;
}

Compilation message

V.cpp: In function 'int main()':
V.cpp:15:22: error: 'strlen' was not declared in this scope
V.cpp:12:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
V.cpp:13:11: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]