上一页 1 ··· 62 63 64 65 66 67 68 69 70 ··· 75 下一页
摘要: 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 阅读(604) 评论(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 阅读(579) 评论(0) 推荐(0)
摘要: 注意:java中,函数可以返回String类 阅读全文
posted @ 2020-06-07 18:00 profesor 阅读(979) 评论(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 阅读(337) 评论(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 阅读(209) 评论(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 阅读(126) 评论(0) 推荐(0)
摘要: JAVA:Math.ceil() , Math.floor() C: ceil(), floor() 阅读全文
posted @ 2020-06-06 09:08 profesor 阅读(141) 评论(0) 推荐(0)
摘要: #include <stdio.h> int main() { int a = 0; while (a < 10){ printf("a is %d\n", a); if ( a == 5) goto OUT; a++; } OUT: printf("We're out of the loop.\n 阅读全文
posted @ 2020-06-06 07:56 profesor 阅读(79) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <string.h> typedef union Person { char name[10]; int age; } pinfo; int main() { pinfo man1; strcpy(man1.name, "Jerry"); pr 阅读全文
posted @ 2020-06-06 07:54 profesor 阅读(64) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <string.h> struct Person { char name[24]; char character[30]; int age; struct Birthday { int day; char month[10]; int year 阅读全文
posted @ 2020-06-05 22:23 profesor 阅读(193) 评论(0) 推荐(0)
上一页 1 ··· 62 63 64 65 66 67 68 69 70 ··· 75 下一页