06 2020 档案
摘要:生成骰子数 #include <stdio.h> #include <time.h> //time() #include <stdlib.h> //srand(), rand() void main() { srand(time(NULL)); for(int i = 0; i < 10; ++i)
阅读全文
摘要:#include <stdio.h> typedef struct { long num; char name[10]; double score; } Stu; int main() { Stu stu[3] = {20115602l, "Jerry", 99.5, 20115600l, "Ela
阅读全文
摘要:一: #include <stdio.h> int main(int argc, const char *argv[]) { int i; for (i = 0; i < argc; ++i) { printf("argv[%d] = %s\n", i, argv[i]); } return 0;
阅读全文
摘要:import sys # print(help(sys.stdout)) sys.stdout.write("the quick brown fox jumps over the lazy dog.") #返回值是字符串长度 sys.stderr.write("to err is humane, t
阅读全文
摘要:#include <stdio.h> int main() { char *temporadas[] = {"primavera", "verano", "otoño", "invierno"}; for (int i = 0; i < 4; ++i) { // printf("%c\n", *((
阅读全文
摘要:获取时间 #include <stdio.h> #include <time.h> int main() { printf("%ld\n", time(NULL)); return 0; } 对应python中 import time print(time.time()) 生成随机骰子数: #inc
阅读全文
摘要:例://找出字符串中所有的is //找出字符串中所有的is #include <stdio.h> #include <string.h> int main(int argc, char const *argv[]) { char s[200] = "Work is like a capricious
阅读全文
摘要:#include <stdio.h> #include <ctype.h> void upper(char *x) { while (*x != '\0') { *x = toupper(*x); x++; } } int main() { char s[] = "De poca estabilid
阅读全文
摘要:students = [("jerry", 25), ("elaine", 24), ("John", 34), ("kramer", 34)] #把年龄在30以上的学生信息提取出来 print([item for item in students if item[1] > 30]) #把年龄在30
阅读全文
摘要:用strchr搜索字符,并把搜索到的字符串保存到新字符串中 #include <stdio.h> #include <string.h> #include <stdlib.h> //用于malloc(), free()函数 int main() { char s[] = "Bienvenidos a
阅读全文
摘要:找出字符串Bienvenidos a todos中所有的字符e #include <stdio.h> #include <string.h> int main() { char s[] = "Bienvenidos a todos"; char * p = strchr(s, 'e'); //通过这
阅读全文
摘要:DNS servers in China https://public-dns.info/nameserver/cn.html How to easily set up a static ip address in Ubuntu using the GUI(12.04) https://www.yo
阅读全文
摘要:方法一: String[] words = new String[] {"precarious", "exiguous", "prodigious"}; //注意new String[] 这里的[]必须是空的 方法二: String[] words = {"precarious", "exiguou
阅读全文
摘要:整齐的二维数组 import java.util.Random; public class a2d { public static void main(String[] args) { var rand = new Random(); int[][] scores = new int[3][5];
阅读全文
摘要://统计[1,100]之间的素数个数,并求和 #include <stdio.h> #include <math.h> #include <stdbool.h> bool isPrime(int ); int main() { int num; // scanf("%d", &num); int s
阅读全文
摘要://把02.txt中的内容写入到05.txt中 import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class Backup { public static void mai
阅读全文
摘要:public class ArrayDemo { public static void main(String[] args) { int[] a = {1, -9, 34, 67, 0, 12 ,34 ,5, 6, 11}; System.out.println(Sum(a)); } static
阅读全文
摘要://用PrintWriter写入文件 import java.io.IOException; import java.io.PrintWriter; public class PrintWriteDemo { public static void main(String[] args) throws
阅读全文
摘要:Employee.java
Manager.java
Driver.java
阅读全文
摘要:https://developers.redhat.com/blog/2018/12/10/install-java-rhel8/ sudo yum install java-11-openjdk-devel sudo yum install java-1.8.0-openjdk-devel
阅读全文
摘要:https://mirrors.ustc.edu.cn/help/centos.html
阅读全文
摘要:指针传递,不返回值 #include <stdio.h> #include <string.h> struct Student { char name[10]; int age; struct subjects { double math; double english; double scienc
阅读全文
摘要: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. 上面
阅读全文
摘要:[C]圆的面积,macro
#define PI 3.1415926 //结尾不需要分号
#define area(r) (PI*(r)*(r)) //整体带括号,内部变量带括号 注意:macro中的变量是没有类型的
阅读全文
摘要://月份与数字之间的对应;
//switch case语句
//指针数组
阅读全文
摘要:public class Calculator { public static void main(String[] args) { //为了避免magic number,采取定义变量 double n1, n2; n1 = 56; n2 = 65; System.out.println(calc(
阅读全文
摘要://StringBuilder class //java.lang.StringBuilder //methods: .append() .toString() // import java.util.Scanner; public class StrBuilder { public static
阅读全文
摘要:注意:java中,函数可以返回String类
阅读全文
摘要: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 (
阅读全文
摘要:计算阶乘 #include <stdio.h> double fact(int); int main() { int x; printf("input a positive integer (<20) to calculate its factorial: "); scanf("%d", &x);
阅读全文
摘要: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
阅读全文
摘要:JAVA:Math.ceil() , Math.floor()
C: ceil(), floor()
阅读全文
摘要:#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
阅读全文
摘要:#include <stdio.h> #include <string.h> typedef union Person { char name[10]; int age; } pinfo; int main() { pinfo man1; strcpy(man1.name, "Jerry"); pr
阅读全文
摘要:#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
阅读全文
摘要:JAVA public class BooksTest { public static void main(String[] args) { int i; for (i = 0; i < args.length; i++) { System.out.printf("args[%d] = %s\n",
阅读全文
摘要:def person(age, **otherInfo): print(age) print(type(otherInfo)) print(otherInfo) person(age=15, sex='male', height=175, weight=56.7, hair='long') 运行结果
阅读全文
摘要:/* 请写成下列宏定义 1.min(a,b) 求a,b的最小值 2.islower(c), 判断c是否为小写字母 3.isleap(year), 判断year是否为闰年 4.circumference(r), 计算半径为r的圆周长 */ #include <stdio.h> #define min(
阅读全文
摘要://pointer to structure #include <stdio.h> struct Person { char name[10]; char character[20]; int age; }; void display(struct Person *t); int main() {
阅读全文
摘要:#include <stdio.h> struct Person { char name[10]; char character[20]; int age; }; void display(struct Person t); int main() { struct Person man = {"je
阅读全文
摘要:#include <stdio.h> struct Person { char name[10]; char character[20]; int age; }; int main() { struct Person man[2]; //创建结构变量数组 for (int i = 0; i < 2;
阅读全文
摘要:struct Person man1 = {"jerry", "fastidious", {"June", 4, 1965}, 34}; //注意这里的对应顺序,可以用curly brace把Birthday括起来
阅读全文
摘要:#include <stdio.h> struct date { int day; char month[10]; int year; }; void out(struct date); // 1.该行一定要置于struct date定义的下面, 2.struct date是新定义的一种数据结构,类
阅读全文
摘要:#include <stdio.h> #include <string.h> struct date { int day; //int month; char month[10]; int year; }; //别丢掉这里的逗号 int main() { struct date today; tod
阅读全文
摘要:#include <stdio.h> #include <string.h> int main() { char str[] = "there are plenty of good reasons "; char str0[] = "for a young person to choose to g
阅读全文
摘要:提醒:在python3中,reduce被移到了functools里面 from functools import reduce str1 = 'the quick brown fox' str2 = ' jumps over ' str3 = 'the lazy dog.' print(reduce
阅读全文