看一下这个,请修改一下

来源:百度知道 编辑:UC知道 时间:2024/05/16 12:01:48
问题是随便输入一组字,比如说是 ABCDE要他PRINTF出来变成EFGHI也就是说A的位置要+4(并不一定是4哦,看输入什么数字了)
#include<stdio.h>
#include"genlib.h"
#include"strlib.h"
#include"simpio.h"
string EncodeString(string ch,int key);
main()
{
string n;
int key;

printf("This program encodes a message using a cyclic cipher.\n");
printf("Enter the numeric key: ");
key= GetInteger();
printf("Enter a message: ");
n=GetLine();

EncodeString(n, key);

}
string EncodeString(string ch, int key)
{
char ch;

ch+=key;
return(ch);}
~
~

你这个GetInteger,GetLine这些函数哪来的啊,以前没见过啊.

还有你是要对string ch这个字符串的每个字符都要加key,但你只在函数里声明了个临时变量,对临时变量加了4,这有什么用.