04 2017 档案

摘要:1 #include 2 #define N 6 3 int sum(int n, const arr[]);//求和函数声明declare 4 int main(void){ 5 int arr[N]; 6 int i; 7 int t_sum = 0; 8 9 for (i = 0; i < N;i++){//input int numb... 阅读全文
posted @ 2017-04-04 19:21 Micheal_you 阅读(321) 评论(0) 推荐(0)
摘要:REMEBER: 1 continue causes the rest of an iteration to be skipped and the next iteration to be started. 2.break causes the program to break free of th 阅读全文
posted @ 2017-04-04 15:58 Micheal_you 阅读(184) 评论(0) 推荐(0)
摘要:#include #include "ctype.h" #define STOP '|' int main(void){ char c;//Initializing long n_char = 0L; int n_word = 0; int n_line = 0; int inword = 0;//This is a flag making sure ... 阅读全文
posted @ 2017-04-04 14:41 Micheal_you 阅读(132) 评论(0) 推荐(0)
摘要:问题背景:判断数字x是否在一个包含N个数字的列表中S。这里采用三种方法来改变主函数中参数值。分别为:返回值(return)、定义全局变量和指针方法 注意(*ptr_location)++ 一定有括号方式一:返回参数 return int 1 #include 2 //void search(int n, int x, const int arr[]); 3 int main(voi... 阅读全文
posted @ 2017-04-04 13:30 Micheal_you 阅读(159) 评论(0) 推荐(0)
摘要:while((c = getchar()) != ' ' && c != '\n') The first subexpression gives a value to c ,which then is used in the second subexpression. while(x++ < 10 && x + y < 20) The fact that the && operator is... 阅读全文
posted @ 2017-04-03 11:50 Micheal_you 阅读(127) 评论(0) 推荐(0)
摘要:REMEBER It demonstates a characteristic C programming style combing two actions in one expression. 阅读全文
posted @ 2017-04-03 11:02 Micheal_you 阅读(169) 评论(0) 推荐(0)
摘要:if (expression) statement 阅读全文
posted @ 2017-04-02 20:31 Micheal_you 阅读(146) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 int main(void){ 4 const int FIRST_OZ = 46; 5 const int NEXT_OZ = 20; 6 int ounces, cost; 7 8 printf(" ounces cost\n"); 9 for (ounces = 1, cos... 阅读全文
posted @ 2017-04-02 12:16 Micheal_you 阅读(157) 评论(0) 推荐(0)
摘要:REMEBER : You should limit yourself to using only < and > in floating-point comparisons. while(status == 1) is ture. and while(status = 1) is ture ... 阅读全文
posted @ 2017-04-02 11:59 Micheal_you 阅读(175) 评论(0) 推荐(0)
摘要:REMEBER: A for loop is appropriate when the loop involves initializing and updating a variable, and a while loop is better when the conditions are oth 阅读全文
posted @ 2017-04-02 11:43 Micheal_you 阅读(125) 评论(0) 推荐(0)