VS2010上没有问题,交上去一直Runtime Error(Segment Fault),求指导

cxc402022-10-04 11:39:541条回答

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("%sn",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.

已提交,审核后显示!提交回复

共1条回复
winter6666 共回答了22个问题 | 采纳率100%
数组越界了 你数组开大点试试
orz还有正则表达式
1年前

相关推荐

VS2010中C板块强制类型转换.
VS2010中C板块强制类型转换.
如题。举个简单的例子:
int m,n;
float x,y;
x=2.5;
y=4.7;
m=(int)x+y;
n=(int)x+m/3;
通过单步调试 m的值居然为6,n的值为4.
再看如下,把强制类型后面操作数加():
int m,n;
float x,y;
x=2.5;
y=4.7;
m=(int)(x+y);
n=(int)(x+m/3);
单步调试:m=7,n=4. vs2010是旗舰版。疑问如下:
1 m后面加括号与不加括号值不一样,而n的值没变化。
2 m的值不加括号的情况下为什么是6,而不是先对x强制整型后再与浮点数y相加,得到6.7呢。
岛上的木瓜1年前3
京城游客 共回答了26个问题 | 采纳率92.3%
VS2010默认是Unicode的,在VC 6.0中编译成功的项目在VS2010中常会出现类型如使用CreateDC("DISPLAY",NULL,NULL,NULL)就会报错,如果使用强制转换(L
VS2010下配置openCV2.2后写了个关于标定的程序
VS2010下配置openCV2.2后写了个关于标定的程序
在编译后出现如下错误:
1>Cal.obj :error LNK2019:无法解析的外部符号 _cvCalibrateCamera2,该符号在函数 _wmain 中被引用
1>Cal.obj :error LNK2019:无法解析的外部符号 _cvDrawChessboardCorners,该符号在函数 _wmain 中被引用
1>Cal.obj :error LNK2019:无法解析的外部符号 _cvFindChessboardCorners,该符号在函数 _wmain 中被引用
1>C:UserskangDesktopCalDebugCal.exe :fatal error LNK1120:3 个无法解析的外部命令
不知道有没有人知道是哪没有配置好?
opencv_core220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib
连接已添加!路径已包含!
米玛11年前4
SoarBar 共回答了23个问题 | 采纳率95.7%
我也遇到过这个问题,请问您解决了吗?
我已经解决了,就是少加了几个lib,如:
#pragma comment( lib,"opencv_imgproc243.lib" )
#pragma comment( lib,"opencv_legacy243.lib" )
#pragma comment( lib,"opencv_calib3d243.lib" )
#pragma comment( lib,"opencv_contrib243.lib" )
,加上去就好啦
请问vs2010中,chart控件画曲线图能否将坐标原点置于左上角,即y轴正方向向下?
困惑的ELLA1年前1
林枫lf 共回答了16个问题 | 采纳率81.3%
如果Y轴为负值,那么数据就是向下的;如果为正值,可以处理为负值,也可以直接设置为反向显示:
this.chart1.ChartAreas[0].AxisY.IsReversed = true;