VS2010上没有问题,交上去一直Runtime Error(Segment Fault),求指导代码:#include#include#includeint main(){char s[20],line[205],last[10];int len,i;while(1){scanf("%s",s);fflush(stdin);if(!strcmp(s,"ENDOFINPUT")) break;//scanf("%[^\n]s",li

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/04 13:33:43

VS2010上没有问题,交上去一直Runtime Error(Segment Fault),求指导代码:#include#include#includeint main(){char s[20],line[205],last[10];int len,i;while(1){scanf("%s",s);fflush(stdin);if(!strcmp(s,"ENDOFINPUT")) break;//scanf("%[^\n]s",li
VS2010上没有问题,交上去一直Runtime Error(Segment Fault),求指导
代码:
#include
#include
#include
int main()
{
char s[20],line[205],last[10];
int len,i;
while(1)
{
scanf("%s",s);
fflush(stdin);
if(!strcmp(s,"ENDOFINPUT")) break;
//scanf("%[^\n]s",line);
gets(line);
fflush(stdin);
scanf("%s",last);
fflush(stdin);
len=strlen(line);
for(i=0;i='A'&&line[i]='F')
{
line[i]-=5;
}
else
{
line[i]=line[i]-4+'Z'-'A';
}
}
}
printf("%s\n",line);
}
return 0;
}
Description
Julius Caesar lived in a time of danger and
intrigue.The hardest situation Caesar ever faced was keeping himself
alive.In order for him to survive,he decided to create one of the
first ciphers.This cipher was so incredibly sound,that no one could
figure it out without knowing how it worked.
You are a sub captain of Caesar's army.It is your job to decipher the
messages sent by Caesar and provide to your general.The code is simple.
For each letter in a plaintext message,you shift it five places to the
right to create the secure message (i.e.,if the letter is 'A',the
cipher text would be 'F').Since you are creating plain text out of
Caesar's messages,you will do the opposite:
Cipher text
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Plain text
V W X Y Z A B C D E F G H I J K L M N O P Q R S T U
Only letters are shifted in this cipher.Any non-alphabetical character
should remain the same,and all alphabetical characters will be upper
case.
Input
Input to this problem will consist of a
(non-empty) series of up to 100 data sets.Each data set will be
formatted according to the following description,and there will be no
blank lines separating data sets.All characters will be uppercase.
A single data set has 3 components:
Start line - A single line,"START"
Cipher message - A single line containing from one to two hundred
characters,inclusive,comprising a single message from Caesar
End line - A single line,"END"
Following the final data set will be a single line,"ENDOFINPUT".
Output
For each data set,there will be exactly one line of output.This is the original message by Caesar.

VS2010上没有问题,交上去一直Runtime Error(Segment Fault),求指导代码:#include#include#includeint main(){char s[20],line[205],last[10];int len,i;while(1){scanf("%s",s);fflush(stdin);if(!strcmp(s,"ENDOFINPUT")) break;//scanf("%[^\n]s",li
数组越界了 你数组开大点试试
orz还有正则表达式

VS2010上没有问题,交上去一直Runtime Error(Segment Fault),求指导代码:#include#include#includeint main(){char s[20],line[205],last[10];int len,i;while(1){scanf(%s,s);fflush(stdin);if(!strcmp(s,ENDOFINPUT)) break;//scanf(%[^ ]s,li 称重传感器的问题目前在用称重传感器做一款实时测量的系统,新板子上去什么问题都没有,测量也很准确,但是第二天重新上电测量的时候,显示会比前一天小一点(注:被称重物一直放在传感 中国航母上为什么没有舰载机?为何一直不见飞机?飞机怎么弄上去?中国自己的舰载机怎么样了?什么水平? 被老师误会上个星期二,因为我没有带一张要写音标的考卷,老师就让我把要写的音标抄四遍,我把连第一遍的四遍音标抄在了那张考卷上.第二天,我把考卷交上去,老师就说我的理解能力有问题, 帮忙看看英语作文语法问题这图是我的英语作业,交上去之前希望大神们帮我检查一下语法上有设么问题没有,或者有其他什么需要改进的地方 我想在百度上回答别人的问题,但我不知道怎么把答案给发上去,有知道的没有 请帮翻几句话,语境是我网上提交上去一份报告,但一直没有回应,我再问一下:我把报告交上去有五天了,其间我无数次满怀希望的查看希望得到好的结果,但一次又一次的失望,这种滋味非常非 有没有歌颂祖国60周年的文章,明天就要交上去了, 我嘞个去.论文修改问题二次修改稿交上去后 导师说我改的还是不够认真 那我第三次该咋改--.这回连附件都没有 直接告诉我不认真 我咋改啊 改哪啊 关于空气开关或者漏电开关跳闸的问题.跳闸后,开关断开是向下跳的,正常是拨上去就可以了!我想问的是,如果跳闸原因和问题没有处理,就是拨上去还会跳,那么如果不懂的人一直按着跳闸开关 英语成绩一直提不上去,怎么办 temple run 有没有终点 temple run有没有终点 temple run有没有终点 我的化学成绩一直没高过,觉得上课都明白,不存在理解上的问题,可成绩一直上不去,徘徊在及格线边缘,大家有没有什么建议? the G can run more quickly than the D.这句话有没有问题?是不是非常的中式 从月球上看地球有没有可能,为什么1.地球一直固定在天空某位置上,没有明显视运动2.太阳也有东升西落视运动,但速度较地表慢第二个问题我明白了,请回答第一个问题1.地球一直固定在天空某 求问一道微积分题目(选择题看着像第一类换元法)公式复制不上去~我直接截图了我一直没有算出来,比较打击我