
笔记
天空下念想
菜鸟学习语言家
展开
-
getline(str,90)
#include #include #include using namespace std; int main (){ char str [90]; cin.getline(str,90); int len = strlen ( str ), r =0, h =0;// r 为行, h 为列 char ans [90][90];// ans [0]~ ans [ r ]存放单词 for ( int i =0; i < len ; i ++){ if ( str [ i ]!=’ ‘){ ans原创 2022-03-24 16:39:40 · 103 阅读 · 0 评论 -
不知道搞了个啥,笔记
import java.io.File; import java.io.FileFilter; import java.io.IOException; public class FileDemo { public static void printDir(File dir) { /* if(dir.isFile()){ System.out.println(dir); } else{ File[] files=dir.listFiles(); for(File file:files){ if(file.i原创 2021-11-26 00:10:53 · 172 阅读 · 0 评论 -
2021-11-15
integr的compareto实现 //compareTo public int compareTo(Integer anotherInteger) { return compare(this.value, anotherInteger.value); } //compare public static int compare(int x, int y) { return (x < y) ? -1 : ((x == y) ? 0 : 1); }原创 2021-11-15 15:53:35 · 239 阅读 · 0 评论 -
2021-11-05
C语言复习1 通过递归替代循环。 通过短路运算符来替代条件判断。 while(scanf("%d",&a))!=EOF)怎么结束? 由于是手动输入(从键盘输入)的数据信息,所以我们要给让此类循环结束,需要我们键入ctrl+z 再加enter就结束了 交换变量可用异或 ...原创 2021-11-05 00:19:32 · 87 阅读 · 0 评论 -
2021-02-05
第二个 #include using namespace std; #include struct hero { string sex; int age; string name; }; void bubblesort(struct hero herroarray[], int len) { for (int i = 0; i < len-1; i++) { for (int j = 0; j < len - 1 - i; j++) { if (herroarray[j].age>原创 2021-02-05 21:30:35 · 81 阅读 · 0 评论 -
2021-02-05
菜鸟学习C加加的第一天 用结构体表示,老师和学生的信息 #include using namespace std; #include #include struct student { string name; int score; }; struct teacher { string name; struct student sarray[5]; }; void allocatespace(struct teacher tarray[], int len) { string nameseed = “ABC原创 2021-02-05 20:51:05 · 125 阅读 · 0 评论