上一页 1 ··· 69 70 71 72 73 74 75 76 77 ··· 82 下一页
摘要: 指针传递,不返回值 #include <stdio.h> #include <string.h> struct Student { char name[10]; int age; struct subjects { double math; double english; double scienc 阅读全文
posted @ 2020-06-12 19:53 profesor 阅读(348) 评论(0) 推荐(0)
摘要: While Loop #!/bin/bash var=1 total=0 while [ $var -lt 101 ]; do total=$((total + var)) var=$((var+1)) done echo sum is $total 注意: 1.“=”两边一定不能有空格 2. 上面 阅读全文
posted @ 2020-06-11 20:00 profesor 阅读(366) 评论(0) 推荐(0)
摘要: [C]圆的面积,macro #define PI 3.1415926 //结尾不需要分号 #define area(r) (PI*(r)*(r)) //整体带括号,内部变量带括号 注意:macro中的变量是没有类型的 阅读全文
posted @ 2020-06-10 22:45 profesor 阅读(214) 评论(0) 推荐(0)
摘要: //月份与数字之间的对应; //switch case语句 //指针数组 阅读全文
posted @ 2020-06-10 22:11 profesor 阅读(404) 评论(0) 推荐(0)
摘要: public class Calculator { public static void main(String[] args) { //为了避免magic number,采取定义变量 double n1, n2; n1 = 56; n2 = 65; System.out.println(calc( 阅读全文
posted @ 2020-06-09 21:54 profesor 阅读(608) 评论(0) 推荐(0)
摘要: //StringBuilder class //java.lang.StringBuilder //methods: .append() .toString() // import java.util.Scanner; public class StrBuilder { public static 阅读全文
posted @ 2020-06-09 14:52 profesor 阅读(583) 评论(0) 推荐(0)
摘要: 注意:java中,函数可以返回String类 阅读全文
posted @ 2020-06-07 18:00 profesor 阅读(984) 评论(0) 推荐(0)
摘要: public class CharAt { public static void main(String[] args) { String ac = "Hello World"; //for (int i = 0; i < ac.length(); i++) int i = 0; //while ( 阅读全文
posted @ 2020-06-07 08:36 profesor 阅读(338) 评论(0) 推荐(0)
摘要: 计算阶乘 #include <stdio.h> double fact(int); int main() { int x; printf("input a positive integer (<20) to calculate its factorial: "); scanf("%d", &x); 阅读全文
posted @ 2020-06-06 21:47 profesor 阅读(214) 评论(0) 推荐(0)
摘要: from functools import reduce i = int(input("input a number 1-10: ")) result = reduce(lambda a, b: a*b, [item for item in range(1,i+1)]) print(f'factor 阅读全文
posted @ 2020-06-06 20:57 profesor 阅读(128) 评论(0) 推荐(0)
上一页 1 ··· 69 70 71 72 73 74 75 76 77 ··· 82 下一页