摘要:
题目:字符串反转,如将字符串 "www.runoob.com" 反转为 "moc.boonur.www"。 程序分析:无。 实例: 1 #include <stdio.h> 2 3 4 void reverse(char* s) 5 { 6 // 获取字符串长度 7 int len = 0; 8 c 阅读全文
摘要:
题目:练习函数调用。 程序分析:无。 实例: 1 #include <stdio.h> 2 void hello_world(void) 3 { 4 printf("Hello, world!\n"); 5 } 6 void three_hellos(void) 7 { 8 int counter; 阅读全文
摘要:
题目:判断一个数字是否为质数。 程序分析:质数(prime number)又称素数,有无限个。一个大于1的自然数,除了1和它本身外,不能被其他自然数整除。 实例: 1 #include<stdio.h> 2 #include<math.h> 3 #define MAX 1000 4 5 6 int 阅读全文
摘要:
题目:删除一个字符串中的指定字母,如:字符串 "aca",删除其中的 a 字母。 程序分析:无。 实例: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 // 删除字符串中指定字母函数 6 char* deleteC 阅读全文
摘要:
题目:请输入星期几的第一个字母来判断一下是星期几,如果第一个字母一样,则继续判断第二个字母。 程序分析:用情况语句比较好,如果第一个字母一样,则判断用情况语句或if语句判断第二个字母。 实例: 1 #include<stdio.h> 2 3 int main() 4 { 5 char i,j; 6 阅读全文