C 中大多数缓冲区溢出问题可以直接追溯到标准 C 库。最有害的罪魁祸首是不进行自变量检查的、有问题的字符串操作(strcpy、strcat、sprintf 和 gets)。一般来讲,象“避免使用 strcpy()”和“永远不使用 gets()”这样严格的规则接近于这个要求。 今天,编写的程序仍然利用...
分类:
其他好文 时间:
2015-08-14 18:57:59
阅读次数:
133
hint:努力提高读题能力吧,尤其在竞赛的时候一份好的心态才能诱发无穷的潜力 做题一定要耐心,细心,专心。心有旁骛只会徒添烦恼。关于gets(),可以搜一下跟scanf()的差别,主要是返回值和读取的终止符的差别。gets()遇到换行符截止,scanf()遇到空格截止;gets()在读取错误和遇.....
分类:
其他好文 时间:
2015-08-13 11:50:25
阅读次数:
138
DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because th...
分类:
其他好文 时间:
2015-08-12 21:30:56
阅读次数:
123
Problem Description
Lillian is a clever girl so that she has lots of fans and often receives gifts from her fans.
One day Lillian gets some segments from her fans Lawson with lengths of 1,2,3......
分类:
其他好文 时间:
2015-08-11 23:33:14
阅读次数:
218
DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because th...
分类:
其他好文 时间:
2015-08-11 18:10:04
阅读次数:
144
C语言中有三种类型的循环:for,while,do-while。 while循环先判断循环条件。 while (condition) { //gets executed after condition is checked } do-while循环先执行循环体重的语句,再判断循环条件。 do { /...
分类:
编程语言 时间:
2015-08-11 15:33:16
阅读次数:
135
您也可以在我的个人博客中阅读此文章:跳转编程题#1:求字母的个数描述在一个字符串中找出元音字母a,e,i,o,u出现的次数。输入输入一行字符串(字符串中可能有空格,请用gets(s)方法把一行字符串输入到字符数组s中),字符串长度小于80个字符。输出输出一行,依次输出a,e,i,o,u在输入字符串中...
分类:
编程语言 时间:
2015-08-11 09:45:56
阅读次数:
453
#include<iostream>usingnamespacestd;#include<cstring>intmain()
{
charstr[1010];while(gets(str))
{
inti;for(i=0;i<strlen(str);i++)
{if(str[i]==‘y‘&&str[i+1]==‘o‘&&str[i+2]==‘u‘)
{cout<<"we";
i+=2;
}else
cout<<str[i]..
分类:
其他好文 时间:
2015-08-09 10:59:55
阅读次数:
101
#include<iostream>usingnamespacestd;#include<cstring>intmain()
{
charstr[1010];while(gets(str))
{
inti;for(i=0;i<strlen(str);i++)
{if(str[i]==‘y‘&&str[i+1]==‘o‘&&str[i+2]==‘u‘)
{cout<<"we";
i+=2;
}else
cout<<str[i]..
分类:
其他好文 时间:
2015-08-09 10:56:26
阅读次数:
122
1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 char a[10010]; 7 int main() 8 { 9 int i,sum,t;10 while(gets(a)){11 ...
分类:
其他好文 时间:
2015-08-07 19:23:37
阅读次数:
95