背景:1Y
思路:类似于选择排序的思想,用一个ans来记录最小值,搜索所有可能值中的最小值。
学习:
1.strcmp(a,b)的返回值是a相对于b的字典序,大则返回1,小则返回-1,等则返回0.
2.一个线性的链要成环的话,就%n。
#include
#include
int main(void){
int t;
char DNA[105],ans[105];
s...
分类:
其他好文 时间:
2015-01-21 11:45:37
阅读次数:
133
#include #include #include #include #include #include #include using std::strcmp;using std::string;using std::vector;#if __cplusplus & files, const ch...
分类:
编程语言 时间:
2015-01-15 21:54:08
阅读次数:
236
strcmp()的函数原型如下()int strcmp(string str1,string str2) 该函数需要两个进行比较的参数字符串,如果这两个字符串相等,该函数就返回0,如果按字典顺序str1在str2后面(大于str2)就返回一个正数,否则,就返回一个负数,这个函数是区分大小写的。 函数...
分类:
其他好文 时间:
2015-01-13 21:16:26
阅读次数:
208
统计一个给定字符串中指定的字符出现的次数
#include
#include
#include
int main()
{
char source[80],dest[5];
int len_s,len_d,*count;
int temp,i,j;
while(1)
{
gets(dest);
gets(source);
if (strcmp(dest,"#")==...
分类:
其他好文 时间:
2015-01-04 23:08:06
阅读次数:
253
比较两个字符串是否相等,最常见的方法就是使用“===”来判断,至于它和“==”的区别,简单来说 就是前者强调“identical”类型也要求一样;后者要求“equal”,值相同就可以了。或者使用strcmp来判断,但是这个能够告 诉你两个字符串是否相等,但是无法告诉你在那里不同。 一般能用 !=,....
分类:
Web程序 时间:
2014-12-23 19:17:01
阅读次数:
190
背景:模拟,结构体,strcmp()。
学习:1.最大的易错点是,除数为0的情况,开始没有考虑,调了才发现。
/*
ID:jibancan1
LANG:C++
TASK:gift1
*/
#include
#include
struct child{
char str[15];
int x; //输出与接收的差值。
...
分类:
其他好文 时间:
2014-12-13 13:33:11
阅读次数:
212
原文:C语言双向链表 今天写了点双向链表的各种操作,写插入的时候费了点时间,不过,现在看来还是值得耗费那点时间去写的,这种小东西应该能信手拈来才行啊。 1 /*双向链表*/ 2 #include 3 #include /*strcmp(const char *,const char *) retur...
分类:
编程语言 时间:
2014-12-12 10:02:21
阅读次数:
230
使用C语言处理行输入的时候,使用fgets()。现在我要在某行输入“ENDOFINPUT”的时候,终止处理。所以果断就写了以下:char buf[256];fgets(buf, 256, stdin);while ( strcmp(buf, "ENDOFINPUT") != 0) { ... }按理...
分类:
其他好文 时间:
2014-11-22 22:58:55
阅读次数:
388
【牛刀小试2】密码保护
主要知识:
1. while循环
2. do-while循环
3. if-else
4. strcmp()函数
[充电一下]
strcmp()函数的知识
原型:int strcmp ( const char * str1, const char * str2 );
返回值:
...
分类:
其他好文 时间:
2014-11-20 13:47:34
阅读次数:
216