C / C++の宿題を片付けます+66代目+355


C/C++の宿題を片付けます 66代目 >> 355

#include <iostream>
using namespace std;

void encode(char *a, char *b);

void decode(char *c, char *d);

int main(void) {
	char str[50+1];

	cout << "暗号化する文字列を入力してください。" << endl;
	cin >> str;

	if(strlen(str) > 50) {
		cout << "50文字までしか入力できません。" << endl << "終了します。" << endl;
		exit(1);
	}

	encode(str, str);
	cout << "暗号文字列:" << str << endl;

	decode(str, str);
	cout << "復元文字列:" << str << endl;

	return 0;
}

void encode(char a[], char b[]) {
	int i = 0;

	while(a[i] != NULL) {
		++a[i++];
	}

	b = a;
}

void decode(char c[], char d[]) {
	int i = 0;

	while(c[i] != NULL) {
		--c[i++];
	}

	d = c;
}

CONTENTS

最新の20件

2020-11-14 2005-12-06 2006-11-04 2012-07-15 2009-06-19 2011-03-03 2006-12-13 2007-11-05 2014-07-22 2014-07-19 2014-07-09 2014-01-14 2012-09-03 2012-03-28

今日の20件

人気の30件

  • counter: 2124
  • today: 1
  • yesterday: 0
  • online: 2