“exit”找不到标识符;“add”“input”不接受0个参数。

void xuanze()
{int a;
scanf("%d",a);
switch(a)
{
case 1:input();break;
case 2:add();break;
case 0:Exit(0);
}
}

2个回答

exit,首字母不大写,input函数形参与实参对不上

yueyue2360
yueyue2360 exit大写以后还是这个样子
大约一年之前 回复
#include "stdio.h"
#include "stdlib.h" //加上这个

void input()
{
//...
}

void add()
{
//...
}

void xuanze()
{
    int a;
    scanf("%d",&a); //加上&
    switch(a)
    {
        case 1:input();break;
        case 2:add();break;
        case 0:exit(0); //逗号半角
    }
}

int main() {
    xuanze();
    return 0;
}

如果问题得到解决,请点下我回答右边的采纳,谢谢

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Flutter开发报错:Error: ADB exited with exit code 1 Performing Streamed Install,一直报这个错,求各位大神帮忙如何解决?
![图片说明](https://img-ask.csdn.net/upload/202001/08/1578444083_268355.png) Error: ADB exited with exit code 1 Performing Streamed Install adb: failed to install E:\20190102\login_app\build\app\outputs\apk\app.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE] Error launching application on Android SDK built for x86. 在运行简单的HelloWorld的时候出现这个错误,原来是没有这种情况的,突然的就报这个错,很无奈啊,已经网上找了很多方法还是没法解决,现求各位大神帮忙解决一下
BOA服务器PHP脚本获取不到POST数据。
使用环境: 1、嵌入式web服务器:boa 0.94; 2、通过php脚本获取post的数据。 问题:获取不到post的数据,读出来为空。 php脚本: #!/bin/php <?php echo "X-Powered-By: PHP/5.5.38\n"; echo "Access-Control-Allow-Origin: *\n"; echo "Content-type: text/html\n\n"; phpinfo(); $post_data=file_get_contents("php://input"); $post_data2=$_POST["certInfo"]; echo "post_data:".$post_data."\r\n"; echo "post_data2:".$post_data2."\r\n"; exit; ?> 抓包看收到了数据,但是php脚本没有获取到。 ![图片说明](https://img-ask.csdn.net/upload/201911/19/1574128040_541524.jpg) postMan测试如下: ![图片说明](https://img-ask.csdn.net/upload/201911/19/1574128168_751132.jpg) 能正常输出phpinfo(),但是接受不到post的数据
A Simple Problem
Problem Description For a given positive integer n, please find the smallest positive integer x that we can find an integer y such that y^2 = n +x^2. Input The first line is an integer T, which is the the number of cases. Then T line followed each containing an integer n (1<=n <= 10^9). Output For each integer n, please print output the x in a single line, if x does not exit , print -1 instead. Sample Input 2 2 3 Sample Output -1 1
Count Problem 的编写
Problem Description In this problem,we need to count the number that accord with the following rule(include the input number n).Read a integer number n(1<=n<=2^31 - 1) first,then do as following ways: (1)Do nothing, then exit the process. (2)Add a digit to the left of it,but the digit should not bigger than the half of the original first digit.For example,from 36 to 136 is legal,but 36 to 236 is illegal because 2 is bigger than half of 3. (3)After add the digit,continue the process,until could not add digit anymore. Input The first line of the input contains an integer T which means the number of test cases.Then T lines follow, each line starts with a number n(1<=n<=2^31 - 1). Output For each test case, you should output one line contains the number that accord with the rule start from n. Sample Input 2 1 6 Sample Output 1 6
pytorch的Process finished with exit code -1073741819 (0xC0000005)
请问用pytorch跑cuda的程序总是中断,Process finished with exit code -1073741819 (0xC0000005)出现这个问题,调试的时候是loss backward()这里出问题了,但是测试cuda一切正常,求解决 ``` import torch print(torch.cuda.is_available()) print(torch.cuda.device_count()) print(torch.cuda.get_device_name()) print(torch.cuda.current_device()) #True #1 #GeForce RTX 2060 SUPER #0 ```
Teleport Out! 怎么解答的
Problem Description You are in a rectangular maze and you would like to leave the maze as quickly as possible. The maze is a rectangular grid of square locations. Some locations are blocked. Some other locations are exits. If you arrive at an exit location, you can immediately leave the maze. You may walk one step at a time, onto one of the locations adjacent to your current location. Two locations are adjacent if they share a side. That is, you can only move one step North, South, East or West. Of course, you cannot step off the maze, and you cannot step onto a blocked location. In addition, at any step, you may choose to use your teleport device. This device will send you to a random non-blocked location inside the maze with uniform probability (including, possibly, the one where you currently are standing!). If the device happens to send you onto a spot that is also an exit, then you leave the maze immediately. Hooray! The only way to leave the maze is by moving onto an exit (either by teleport or walking), you may not walk off the boundary of the maze. Write a program to calculate the expected number of steps you need in order to leave the maze. Assume that you would choose your actions (movements and using teleport device) optimally in order to minimize the expected number of steps to leave the maze. Using the teleport device is considered one step. Input There will be multiple test cases. Each test case starts with a line containing two positive integers R and C ( R<=200, C<=200 ). Then, the next R lines each contain C characters, representing the locations of the maze. The characters will be one of the following: E : represents an exit, there will be at least one `E' in every maze. Y : represents your initial location, there will be exactly one `Y' in every maze. X : represents a blocked location. . : represents an empty space. You may move/teleport onto any location that is marked `E', `Y' or `.'. The end of input is marked by a line with two space-separated 0's. Output For each test case, print one line containing the minimum expected number of steps required to leave the maze, given that you make your choices optimally to minimize this value. Print your result to 3 decimal places. Do not print any blank lines between outputs. Sample Input 2 1 E Y 2 2 E. .Y 3 3 EX. XX. ..Y 3 3 EXY .X. ... 0 0 Sample Output 1.000 2.000 6.000 3.250
hadoop使用yarn运行jar 报java.lang.ClassNotFoundException 找不到类 (找不到的不是主类)
1、写了一个数据分析的程序,用idea打成jar包,依赖jar都打进去了 ![图片说明](https://img-ask.csdn.net/upload/201911/03/1572779664_439750.png) 已经设置了 job.setJarByClass(CountDurationRunner.class); 2、开启hadoop zookeeper 和hbase集群 3、yarn运行jar : $ /opt/module/hadoop-2.7.2/bin/yarn jar ct_analysis.jar runner.CountDurationRunner 报错截图:![图片说明](https://img-ask.csdn.net/upload/201911/03/1572779908_781957.png) CountDurationRunner类代码: ``` package runner; import kv.key.ComDimension; //就是这里第一个就没找到 import kv.value.CountDurationValue; import mapper.CountDurationMapper; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; import outputformat.MysqlOutputFormat; import reducer.CountDurationReducer; import java.io.IOException; public class CountDurationRunner implements Tool { private Configuration conf = null; @Override public void setConf(Configuration conf) { this.conf = HBaseConfiguration.create(conf); } @Override public Configuration getConf() { return this.conf; } @Override public int run(String[] args) throws Exception { //得到conf Configuration conf = this.getConf(); //实例化job Job job = Job.getInstance(conf); job.setJarByClass(CountDurationRunner.class); //组装Mapper InputFormat initHbaseInputConfig(job); //组装Reducer outputFormat initHbaseOutputConfig(job); return job.waitForCompletion(true) ? 0 : 1; } private void initHbaseOutputConfig(Job job) { Connection connection = null; Admin admin = null; String tableName = "ns_ct:calllog"; try { connection = ConnectionFactory.createConnection(job.getConfiguration()); admin = connection.getAdmin(); if(!admin.tableExists(TableName.valueOf(tableName))) throw new RuntimeException("没有找到目标表"); Scan scan = new Scan(); //初始化Mapper TableMapReduceUtil.initTableMapperJob( tableName, scan, CountDurationMapper.class, ComDimension.class, Text.class, job, true); }catch (IOException e){ e.printStackTrace(); }finally { try { if(admin!=null) admin.close(); if(connection!=null) connection.close(); } catch (IOException e) { e.printStackTrace(); } } } private void initHbaseInputConfig(Job job) { job.setReducerClass(CountDurationReducer.class); job.setOutputKeyClass(ComDimension.class); job.setOutputValueClass(CountDurationValue.class); job.setOutputFormatClass(MysqlOutputFormat.class); } public static void main(String[] args) { try { int status = ToolRunner.run(new CountDurationRunner(), args); System.exit(status); } catch (Exception e) { e.printStackTrace(); } } } 这问题困扰很久了,有人说classPath不对,不知道如何修改,求助! ```
pycharm运行pyqt5报错‘finished with exit code -1073740791 (0xC0000409)
用pycharm运行由 qt designer 设计的gui,已经填充一些槽函数代码,GUI的首页可以显示,一旦点击按钮就会程序退出,出现代码报错代码‘finished with exit code -1073740791 (0xC0000409)’
Java的死循环里的代码不执行
死循环里的代码不执行,但是在死循环里加个输出就执行,并且线程也没有退出 ``` package shendi.utils; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; /** * -问题 代码原封不动运行,two函数里的死循环感觉像是挂了一样 但是线程没有结束 不执行 * -但是在循环内加个输出,函数就没有问题,Why? */ public class Test extends JFrame implements Runnable { private String type; private static int i = 0; public Test() { JButton button = new JButton("i+1"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { i++; System.out.println("two函数的死循环就是不会被执行 + i现在是:"+i); } }); this.add(button); this.setBounds(10, 10,100,100); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setVisible(true); new Thread(new Test("1")).start(); new Thread(new Test("2")).start(); } public Test(String type) {this.type = type;} public static void main(String[] args) { new Test(); } private void one() { while (true) { // System.out.println(i); } } private void two() { System.out.println("two被调用了,线程 "); while (true) { if (1 == 2) break; // if (i == 0) System.out.println("i=0 two函数"); if (i > 1) System.out.println("我是活的"); } System.out.println("two挂了"); } public void run() { switch (type) { case "1": one(); break; case "2": two(); break; } } } ```
大神们 这个要是改接口,把px4到px0改成px7到px3这个代码需要改哪呢?
Px.4 - Px.0口线连接5个LED灯LED4 - LED0;KEY1键为启动按键,连接外部中断1;KEY2键为急停按键,连接外部中断0。按要求进行硬件接线,并利用定时器T0和外部中断编写程序实现如下功能:(1)程序运行开始LED灯全灭,KEY1键按下,触发外部中断1,LED灯开始按要求的顺序点亮:即使5个LED灯间隔0.6s,按以下顺序循环点亮:亮灭灭灭灭,灭亮灭灭灭,灭灭亮灭灭,灭灭灭亮灭,灭灭灭灭亮,如此循环;(2)KEY2 键按下,触发外部中断0,使5个LED灯全亮。(晶振频率为12MHz) ORG 00H AJMP MAIN ORG 03H AJMP JITING ORG 13H AJMP WAIBU ORG 0BH AJMP DINGSHIQI ORG 30H MAIN: MOV TMOD,#01H MOV TH0,#15H MOV TL0,#0A0H SETB EA SETB EX0 SETB IT0 SETB ET0 SETB EX1 SETB IT1 MOV R4,#10 SJMP $ ORG 50H WAIBU: MOV A,#0FEH MOV P0,A SETB TR0 RETI ORG 60H DINGSHIQI: MOV TH0,#15H MOV TL0,#0A0H DJNZ R4,EXIT MOV R4,#10 RL A CJNE A,#11011111B,TIAO MOV A,#0FEH RETI ORG 70H TIAO: MOV P0,A EXIT:RETI ORG 80H JITING: MOV A,#00H MOV P0,A RETI END
c语言图书管理系统设计,卡在查找时如果是找不到则程序出错,大神能帮我解决一下吗?
输入是成功,但是如果查找的不是已输入,则程序出错。 #include <stdio.h> #include <stdlib.h> #include <string.h> //定义一本书 struct book { char name[10]; char writer[10]; char publisher[21]; char price[5]; }; struct Node { //int data; struct book data; struct Node* next; }; //创建表 struct Node* createList() { //结构体变量表示表头 //指针--->变量 动态内存申请 struct Node* headNode = (struct Node*)malloc(sizeof(struct Node)); headNode->next = NULL; return headNode; } //创建结点 struct Node* createNode(struct book data) { struct Node* newNode = (struct Node*)malloc(sizeof(struct Node)); newNode->data = data; newNode->next = NULL; return newNode; } //插入结点 void insertNodeByHead(struct Node* headNode, struct book data) { struct Node* newNode = createNode(data); //表头法 newNode->next = headNode->next; headNode->next = newNode; } //指定位置删除 void deleteAppoinNode(struct Node* headNode, char* name) { //struct book struct Node* posNode = headNode->next; struct Node* posFrontNode = headNode; if (posNode == NULL) { printf("数据为空,无法删除!\n"); return; } //书名是字符串,字符串:strcmp while (strcmp(posNode->data.name,name)) { posFrontNode = posNode; posNode = posFrontNode->next; if (posNode == NULL) { printf("未找到指定位置无法删除!\n"); return; } } //找到了 posFrontNode->next = posNode->next; free(posNode); } //查找功能 struct Node* searchInfoByData(struct Node* headNode, char *name) { struct Node* pMove = headNode->next; if (pMove == NULL) return NULL; while (strcmp(pMove->data.name, name)) { pMove = pMove->next; } return pMove; } //打印 void printList(struct Node* headNode) { struct Node* pMove = headNode->next; //设计到数据的处理 printf("书名\t作者\t出版社\t价格\n"); while (pMove) { printf("%s\t%s\t%s\t%s\n", pMove->data.name, pMove->data.writer, pMove->data.publisher, pMove->data.price); pMove = pMove->next; } printf("\n"); } void menu() { //所有操作都同步到文件 printf("-------------【图书信息管理系统】-----------\n"); printf("\t\t1.录入图书信息\n"); printf("\t\t2.浏览图书信息\n"); printf("\t\t3.修改图书信息\n"); printf("\t\t4.删除图书信息\n"); printf("\t\t5.查找图书信息\n"); printf("\t\t0.退出系统\n"); printf("-------------------------------------------\n"); } struct Node* list = createList(); //接收指令 void keyDown() { int choice = 0; struct book data; struct Node* pMove = NULL; scanf("%d", &choice); switch (choice) { case 0: printf("正常退出!\n"); system("pause"); exit(0); break; case 1: printf("--------------【录入图书信息】-----------\n"); //插入链表 printf("请输入书名,作者,出版社,价格:\n"); fflush(stdin); //清空缓冲区 scanf("%s%s%s%s", data.name, &data.writer, data.publisher, data.price); insertNodeByHead(list, data); break; case 2: printf("--------------【浏览图书信息】-----------\n"); printList(list); //打印链表 break; case 3: printf("--------------【修改图书信息】-----------\n"); printf("请输入要修改的书名:"); scanf("%s", data.name); pMove = searchInfoByData(list, data.name); if (pMove == NULL) { printf("未找到相关信息,无法修改!\n"); system("pause"); } else { printf("请输入图书名,作者,出版社,价格:"); scanf("%s%s%s%s", data.name, &data.writer, data.publisher, data.price); strcpy(pMove->data.name, data.name); strcpy(pMove->data.writer, data.writer); strcpy(pMove->data.publisher, data.publisher); strcpy(pMove->data.price, data.price); } break; case 4: printf("--------------【删除图书信息】-----------\n"); printf("请输入删除的书名:"); scanf("%s", data.name); deleteAppoinNode(list, data.name); break; case 5: printf("--------------【查找图书信息】-----------\n"); printf("请输入要查找的书名:"); scanf("%s", data.name); pMove = searchInfoByData(list, data.name); if (pMove == NULL) { printf("未找到相关信息,无法删除!\n"); system("pause"); } else { printf("书名\t作者\t出版社\t价格\n"); printf("%s\t%s\t%s\t%s\n", pMove->data.name, pMove->data.writer, pMove->data.publisher, pMove->data.price); } break; default: printf("选择错误,重新输入\n"); system("pause"); break; } } int main() { while (1) { menu(); keyDown(); system("pause"); system("cls"); } system("pause"); return 0; }
小组合作做了一个简陋的学生信息管理系统,修改学生信息的部分一直有问题,麻烦大神帮我看一下到底有什么问题,我真找不出来。
#include<stdio.h> #include<conio.h> #include<string.h> #include<ctype.h> #include<stdlib.h> #define N 10000 typedef struct student { char ID[20]; // 学号 char name[20]; // 姓名 char sex; // 性别 double score[3]; // 三科成绩 double total; // 总分 double avg; // 平均分 }STUDENT; void memu(void); void load(STUDENT stu[],int *nptr); // 将学生信息加载到数组stu中 void save(STUDENT stu[],int n); // 将学生信息保存在磁盘中 void add(STUDENT stu[],int *nptr); // 添加学生信息 void output(STUDENT stu[],int n); // 输出所有学生信息 void InputRecord(STUDENT stu[],int i);// 添加第n+1个学生的信息 void PrintRecord(STUDENT *sptr); // 输出指针sptr所指记录的内容 void edit(STUDENT stu[],int n); // 修改学生信息 void statis(STUDENT stu[], int n); void del(STUDENT stu[],int *nPtr); // 删除学生信息 int main() { int select; int n; STUDENT stu[N]; load(stu,&n); while(1) { memu(); scanf("%d",&select); switch(select) { case 1: // 录入学生成绩 add(stu,&n); break; case 2: // 显示学生信息 output(stu, n); break; case 3: // 修改学生信息 edit(stu,n); break; case 4: // 删除学生信息 del(stu,&n); break; case 5: // 查找学生信息 break; case 6: statis(stu, n); // 统计个科目最高分 break; case 7: // 按总分顺序排序 break; case 0: // 退出系统 break; default: printf("你输入的有误,请重新输入"); break; } } } void memu(void) { system("cls"); printf(" 欢迎使用高校学生管理系统 "); printf("\t\t 菜单 \n"); printf("\t\t1.录入学生的成绩\n"); printf("\t\t2.显示学生信息\n"); printf("\t\t3.修改学生信息\n"); printf("\t\t4.删除学生信息\n"); printf("\t\t5.查找学生信息\n"); printf("\t\t6.统计各科目最高分、平均分和不及格人数\n"); printf("\t\t7.按总分排序\n"); printf("\t\t0.退出系统\n"); } //将学生信息加载到数组stu中 void load(STUDENT stu[],int *nptr) { FILE *fp; //定义文件指针 int i; if((fp=fopen("D:\\student.txt","r"))==NULL) { *nptr=0; return ; } for(i=0; fread(&stu[i],sizeof(STUDENT),1,fp)!=0; i++) { *nptr=i; //*nptr记录文件中当前学生数量 } fclose(fp); //关闭文件 } //将学生信息保存在磁盘中 void save(STUDENT stu[],int n) { FILE *fp; //定义文件指针 if((fp=fopen("D:\\student.txt","w"))==NULL) // { printf("打开文件失败\n"); exit(0); } fwrite(stu,n*sizeof(stu[0]),1,fp); fclose(fp); //关闭文件 } //添加学生信息 void add(STUDENT stu[],int *nptr) { int i=0; char sel = 'Y'; while(sel=='Y') { InputRecord(stu,(*nptr)++); //添加第n+1个学生的信息 printf("if you want stop ? yes(Y) or no(N)\n"); scanf(" %c",&sel); } save(stu,*nptr); } //输入一个学生信息,存到score[i]中 void InputRecord(STUDENT stu[],int i) { int j; //输入学号,并验证合法性 printf("输入第%d个学生的信息\n",i+1); printf("输入学生学号(学号小于9位数字组成)\n"); scanf("%s",&stu[i].ID); printf("请输入学生姓名\n"); scanf("%s",stu[i].name); printf("请输入学生性别(f或m f代表女性 m代表男性)\n"); scanf(" %c",&stu[i].sex); //输入五门课成绩并累加 printf("输入三门课成绩(0~100)\n"); stu[i].total=0; for(j=0;j<3;j++) { scanf("%lf",&stu[i].score[j]); stu[i].total+=stu[i].score[j]; } //计算总成绩 stu[i].avg=stu[i].total/3; } //输出所有学生信息 void output(STUDENT stu[],int n) { int i; //打印表头 printf("%8s%8s%4s%8s%8s%8s%8s%8s%8s%8s\n","ID","NAME","SEX", "SCORE1","SCORE2","SCORE3","SCORE4","SCORE5","total","avg"); //打印所有记录 for(i=0;i<n;i++) { PrintRecord(&stu[i]); } system("pause"); } //输出指针sptr所指记录的内容 void PrintRecord(STUDENT *sptr) { int i; printf("%8s%8s%4c",sptr->ID,sptr->name,sptr->sex); for(i=0;i<3;i++) { printf("%8.2f",sptr->score[i]); } printf("%8.2f%8.2f",sptr->total,sptr->avg); printf("\n"); } void edit(STUDENT stu[],int n) { int i,index; char sel; char str[20]; printf("输入学号"); scanf("%s",str); index=FindByNum(stu,n,str); if(index<0) { printf("该学生信息不存在\n"); //信息不存在的情况 return; } printf("请输入需更改的项目\n1.姓名\n2.性别\n3.科目成绩\n4.总成绩\n5.平均成绩/n(输入序号即可)\n"); int a; //菜单栏 scanf("%d",&a); switch(a) { case 1: printf("修改前的姓名如下:\n"); //修改姓名 PrintRecord(&stu[index]); printf("请输入修改后的姓名:\n"); scanf("%s",stu[index].name); case 2: printf("修改前的性别如下:\n"); //修改性别 PrintRecord(&stu[index]); printf("请输入修改后的性别:\n"); scanf("%s",stu[index].sex); case 3: printf("修改前的科目成绩如下:\n"); //修改科目成绩 PrintRecord(&stu[index]); printf("请输入修改后的科目成绩:\n"); scanf("%s",stu[index].score); case 4: printf("修改前的总成绩如下:\n"); //修改总成绩 PrintRecord(&stu[index]); printf("请输入修改后的总成绩:\n"); scanf("%s",stu[index].total); case 5: printf("修改前的平均成绩如下:\n"); //修改平均成绩 PrintRecord(&stu[index]); printf("请输入修改后的平均成绩:\n"); scanf("%s",stu[index].avg); } save(stu,n); } int FindByNum(STUDENT stu[],int n,char *str) { int i; for(i=0;i<n;i++) if(strcmp( stu[i].ID,str)==0) return i; return -1; } void statis(STUDENT stu[], int n) { int i, fail;//“stu[]”为学生 “score[]”为成绩 “n”为人数 max为最高分数 fail 为不及格人数 sum为50人总分 double score[3], max, sum, avg;//“avg”为平均分 avg = 0; max = 0; fail = 0; sum = 0; for(i = 0; i < n; i++) { sum += stu[i].score[0]; avg = sum/n; if(max < stu[i].score[0]) max = stu[i].score[0]; if(stu[i].score[0] < 60) fail++; } printf("C语言最高分=%.2f\n",max); printf("C语言不及格人数=%d\n",fail); printf("C语言平均分=%.2f\n",avg); fail = 0; sum = 0; max = 0; for(i = 0; i < n; i++) { sum += stu[i].score[1]; avg = sum/n; if(max < stu[i].score[1]) max = stu[i].score[1]; if(stu[i].score[1] < 60) fail++; } printf("英语最高分=%.2f\n",max); printf("英语不及格人数=%d\n",fail); printf("英语平均分=%.2f\n",avg); fail = 0; sum = 0; max = 0; for(i = 0; i < n; i++) { sum += stu[i].score[2]; avg = sum/n; if(max < stu[i].score[2]) max = stu[i].score[2]; if(stu[i].score[2] < 60) fail++; } printf("数学最高分=%.2f\n",max); printf("数学不及格人数=%d\n",fail); printf("数学平均分=%.2f\n",avg); system("pause"); fail = 0; sum = 0; max = 0; } // 删除学生信息 void del(STUDENT stu[],int *nPtr) { int i,index; char str[20]; printf("请你输入学号"); scanf("%s",str); index = FindByNum(stu,*nPtr,str); if(index<0) { printf("\n 亲,不好意思,你所选的学生信息不存在\n"); system("pause"); return ; } for (i = index; i < *nPtr-1;i++) stu[i] = stu[i+1]; (*nPtr)--; printf("\n 恭喜恭喜 删除成功 \n"); system("pause"); save(stu,*nPtr); // 保存到文件中 }
使用CLion遇到的问题 multiple definition of `main' ld returned 1 exit status
![图片说明](https://img-ask.csdn.net/upload/202001/09/1578585095_670327.png) [ 33%] Linking CXX executable untitled.exe CMakeFiles\untitled.dir/objects.a(test.cpp.obj): In function `main': C:/Users/Lee/CLionProjects/untitled/test.cpp:2: multiple definition of `main' CMakeFiles\untitled.dir/objects.a(main.cpp.obj):C:/Users/Lee/CLionProjects/untitled/main.cpp:3: first defined here collect2.exe: error: ld returned 1 exit status mingw32-make.exe[3]: *** [CMakeFiles\untitled.dir\build.make:100: untitled.exe] Error 1 mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:75: CMakeFiles/untitled.dir/all] Error 2 mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:82: CMakeFiles/untitled.dir/rule] Error 2 mingw32-make.exe: *** [Makefile:117: untitled] Error 2 最开始是Cmake有问题 用大佬帖子里的方法改了系统文件夹名字之后好了 然鹅 不知道是什么情况 麻烦大佬们帮忙看看
本人是初学者看一些代码有些不懂,还请大神指点一下,谢谢
${ msg }表示什么意思呢??? index.jsp怎么跳转到main.jsp呢??? **index.jsp** ``` <html > <title>聊天室</title> <link href="CSS/style.css" rel="stylesheet"> <script type="text/javascript"> function check(){ if(document.getElementById("form1").username.value==""){ alert("请输入用户名!"); document.getElementById("form1").username.focus(); return false; } if(document.getElementById("form1").password.value==""){ alert("请输入密码名!"); document.getElementById("form1").password.focus(); return false; } } </script> <body> <br> <center><h3 style="color:red;">${ msg }</h3></center> <form id="form1" name="form1" method="post" action="${pageContext.request.contextPath }/user" onSubmit="return check()"> <input type="hidden" name="method" value="login"> <table width="371" height="230" border="0" align="center" cellpadding="0" cellspacing="0" background="images/login.jpg"> <tr> <td height="120" colspan="3" class="word_dark">&nbsp;</td> </tr> <tr> <td width="53" align="center" valign="top" class="word_dark">&nbsp;</td> <td width="216" align="center" valign="top" class="word_dark"> <table width="100%" height="100%"> <tr> <td>用户名:</td> <td><input type="text" name="username" class="login"></td> </tr> </table> </td> <td width="94" valign="top" class="word_dark"></td> </tr> <tr> <td width="53" align="center" valign="top" class="word_dark">&nbsp;</td> <td width="216" align="center" valign="top" class="word_dark"> <table width="100%" height="100%"> <tr> <td>密&nbsp;&nbsp;码:</td> <td><input type="password" name="password" class="login"></td> </tr> </table> </td> <td width="94" valign="top" class="word_dark"></td> </tr> <tr> <td width="53" align="center" valign="top" class="word_dark">&nbsp;</td> <td width="216" align="center" valign="top" class="word_dark"> <input name="Submit" type="submit" class="btn_bg" value="进 入"> </td> <td width="94" valign="top" class="word_dark"> </td> </tr> </table> </form> </body> </html> ``` **main** ``` <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ include file="safe.jsp"%> <html> <head> <title>聊天室</title> <link href="CSS/style.css" rel="stylesheet"> <script type="text/javascript" src="${ pageContext.request.contextPath }/js/jquery-1.8.3.js"></script> <script type="text/javascript"> var sysBBS = "<span style='font-size:14px; line-height:30px;'>欢迎光临心之语聊天室,请遵守聊天室规则,不要使用不文明用语。</span><br><span style='line-height:22px;'>";var sysBBS = "<span style='font-size:14px; line-height:30px;'>欢迎光临心之语聊天室,请遵守聊天室规则,不要使用不文明用语。</span><br><span style='line-height:22px;'>"; window.setInterval("showContent();",1000); window.setInterval("showOnLine();",10000); window.setInterval("check();",1000); // Jquery:JS框架. // 相当于window.onload $(function(){ showOnLine(); showContent(); check(); }); function check(){ $.post("${pageContext.request.contextPath}/user?method=check",function(data){ if(data == 1){ // 提示用户下线了 alert("用户已经被踢下线了!"); // 回到登录页面! window.location = "index.jsp"; } }); } // 显示在线人员列表 function showOnLine(){ // 异步发送请求 获取在线人员列表 // Jquery发送异步请求 $.post("${pageContext.request.contextPath}/online.jsp?"+new Date().getTime(),function(data){ // $("#online") == document.getElementById("online"); $("#online").html(data); }); } // 显示聊天的内容 function showContent(){ $.post("${pageContext.request.contextPath}/user?"+new Date().getTime(),{'method':'getMessage'},function(data){ $("#content").html(sysBBS+data); }); } function set(selectPerson){ //自动添加聊天对象 if(selectPerson != "${existUser.username}"){ form1.to.value=selectPerson; }else{ alert("请重新选择聊天对象!"); } } function send(){ if(form1.to.value==""){ alert("请选择聊天对象!"); return false; } if(form1.content.value==""){ alert("发送信息不可以为空!"); form1.content.focus(); return false; } // $("#form1").serialize():让表单中所有的元素都提交. // jquery提交数据.{id:1,name:aa,age:25} $.post("${pageContext.request.contextPath}/user?"+new Date().getTime(),$("#form1").serialize(),function(data){ $("#content").html(sysBBS+data+"</span>"); }); } function exit(){ alert("欢迎您下次光临!"); window.location.href="${pageContext.request.contextPath}/user?method=exit"; } function checkScrollScreen(){ if(!$("#scrollScreen").attr("checked")){ $("#content").css("overflow","scroll"); }else{ $("#content").css("overflow","hidden"); //当聊天信息超过一屏时,设置最先发送的聊天信息不显示 //alert($("#content").height()); $("#content").scrollTop($("#content").height()*2); } setTimeout('checkScrollScreen()',500); } </script> </head> <body> <table width="778" height="150" border="0" align="center" cellpadding="0" cellspacing="0" background="images/top.jpg"> <tr> <td>&nbsp;</td> </tr> </table> <table width="778" height="276" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="165" valign="top" bgcolor="#f6fded" id="online" style="padding:5px">在线人员列表</td> <td width="613" height="200px" valign="top" background="images/main_bj.jpg" bgcolor="#FFFFFF" style="padding:5px; "> <div style="height:290px; overflow:hidden" id="content">聊天内容</div></td> </tr> </table> <table width="778" height="95" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#D6D3CE" background="images/bottom.jpg"> <form action="" id="form1" name="form1" method="post"> <input type="hidden" name="method" value="sendMessage"/> <tr> <td height="30" align="left">&nbsp;</td> <td height="37" align="left"> <input name="from" type="hidden" value="${existUser.username}">[${existUser.username} ]对 <input name="to" type="text" value="" size="35" readonly="readonly"> 表情 <select name="face" class="wenbenkuang"> <option value="无精打采的">无精打采的</option> </select> 说:</td> <td width="189" align="left">&nbsp;&nbsp;字体颜色: <select name="color" size="1" class="wenbenkuang" id="select"> <option selected>默认颜色</option> <option style="color:#999999" value="999999">烟雨蒙蒙</option> </select> </td> <td width="19" align="left"><input name="scrollScreen" type="checkbox" class="noborder" id="scrollScreen" onClick="checkScrollScreen()" value="1" checked> </td> </tr> <tr> <td width="21" height="30" align="left">&nbsp;</td> <td width="549" align="left"> <input name="content" type="text" size="70" onKeyDown="if(event.keyCode==13 && event.ctrlKey){send();}"> <input name="Submit2" type="button" class="btn_grey" value="发送" onClick="send()"> </td> <td align="right"><input name="button_exit" type="button" class="btn_grey" value="退出聊天室" onClick="exit()"> </td> <td align="center">&nbsp;</td> </tr> <tr> <td height="30" align="left">&nbsp;</td> <td align="center">&nbsp;</td> </tr> </form> </table> </body> </html> ```
求救帮忙看一下我这个用C语言写的顺序线性表线性表合并为什么会有warning C4020: ?一直找不到原因
调试环境VC6.0 ``` #include<stdlib.h> #include<stdio.h> typedef int Status; // Status 是函数返回值类型,其值是函数结果状态代码。 #define OK 1 #define ERROR 0 #define OVERFLOW -2 #define List_Init_Size 100 //线性表存储空间初始分配量 #define Listincerment 10 //线性表存储空间的分配增量 typedef struct SqList { int *elem; int length; int listsize; //当前分配的存储容量() }SqList; Status InitList_Sq(SqList*L) {//初始化顺序线性表// L->elem=(int*)malloc(List_Init_Size*sizeof(int)); if(!L->elem)exit(OVERFLOW); //存储分配失败 L->length=0; return OK; } Status GetElem(SqList a,int i,int*e) { //读取元素 if(i<0||i>a.length) return ERROR; e=&a.elem[i-1]; //i-1存储第i个元素 return OK; } int ListLength(SqList L) { //计算长度 if(!L.elem)exit(ERROR); return L.length; } Status ListInsert_Sq(SqList *L, int i, int e) { //i位置之前插入新元素e if(i<1||i>L->length+1)return ERROR; if((L->length)>=(L->listsize)){ //当前存储空间已满,增加分配 int*newbase,*q,*p; newbase=(int*)realloc(L->elem,(L->listsize+Listincerment)*sizeof(int)); if(!newbase)exit(OVERFLOW);//存储分配失败} L->elem=newbase; //新的基址 L->listsize+=Listincerment; //增加容器容量 q=&(L->elem[i-1]); //q为插入位置 for(p=&(L->elem[L->length-1]);p>=q;--p) *(p+1)=*p; //插入位置及以后的元素后移 *q=e; //插入e ++L->length; } return OK;} void MergeList(SqList La,SqList Lb,SqList*Lc) { //线性表La和Lb中的数据元素按照值非递减排列。 int i,j,k,ai,bj; InitList_Sq(Lc); i=j=1;k=0; La.length=ListLength(La); Lb.length=ListLength(Lb); while((i<=La.length)&&(j<=Lb.length)) { GetElem(La,i,&ai); GetElem(Lb,j,&bj); if(ai<=bj) { ListInsert_Sq(Lc,++k,ai); ++i;} else{ListInsert_Sq(Lc,++k,bj);++j;} } while(i<=La.length) { GetElem(La,i,&ai); i++; ++k; InitList_Sq(Lc,k,&ai);} while(j<=Lb.length) { GetElem(Lb,j,&bj);j++; ++k; InitList_Sq(Lc,k,&bj); } } void output(SqList L) { int i; for(i=0;i<L.length;i++) { printf("%d ",L.elem[i]); } } void main() { SqList a,b,c; int i,j,k; InitList_Sq(&a); InitList_Sq(&b); printf("输入要写入链表a中元素的个数"); scanf("%d",&j); printf("输入每个元素"); for(i=1;i<=j;i++) { int e; scanf("%d",&e); ListInsert_Sq(&a,i,e); } printf("输入要写入链表b中元素的个数\n"); scanf("%d",&k); printf("输入每个元素"); for(j=1;j<=k;i++) { int e; scanf("%d",&e); ListInsert_Sq(&b,i,e); } MergeList(a,b,&c); output(c); } ``` ![图片说明](https://img-ask.csdn.net/upload/201912/02/1575268330_217932.png)
ubnutu socket实现不同主机通信 客户端链接服务端拒绝链接
客户端 ``` #include<stdlib.h> #include<sys/types.h> #include<stdio.h> #include<sys/socket.h> #include<string.h> #include<arpa/inet.h> #include<unistd.h> #include<errno.h> #include<pthread.h> void sent(int *qian){ int q=*qian; char buff[1024]; int len; while(1){ bzero(buff,1025); fgets(buff,1024,stdin); // len=send(q,buff,30,0); if(len<0){ perror("send "); break; } if(!strncasecmp(buff,"quit",4)){ printf("I will quit!\n"); break; } } close(q); pthread_exit(NULL); } int main(){ int lian,len; char buff[30]; struct sockaddr_in dest; if((lian=socket(AF_INET,SOCK_STREAM,0))<0){ printf("socket error!\n"); return -1; } printf("socket created\n"); bzero(&dest,sizeof(dest)); dest.sin_family=AF_INET; dest.sin_port=htons(8088); inet_aton(("127.0.0.1"),(struct in_addr*)&dest.sin_addr.s_addr); if(connect(lian,(struct sockaddr *)&dest,sizeof(dest))==-1){ perror("connect "); exit(1); } printf("sercer connect\n"); pthread_t sended; pthread_create(&sended,NULL,(void*)sent,&lian); while(1){ bzero(buff,30); len=recv(lian,buff,30,0); if(len<=0){ perror("recv "); break; } else if(len>0)printf("%s\n",buff); else { printf("the other one close,quit\n"); break; } } pthread_join(sended,NULL); //等待sended线程结束之后,主线程才能结束 close(lian); return 0; } ``` 服务端 ``` #include <stdlib.h> #include <sys/types.h> #include <stdio.h> #include <sys/socket.h> #include <string.h> #include <signal.h> #include <arpa/inet.h> #include <unistd.h> #include <pthread.h> #include <fcntl.h> #include <time.h> #include<errno.h> int num=0; int new_fd[5]; struct sockaddr_in myaddr,itaddr; void sended(int *qian){ char buf[30]; int len; int q=*qian; char mass[60]; len=sizeof(struct sockaddr); while(1){ if((recv(q,buf,30,0))<=0){ //接收来自客户端的消息 break; } if(strncasecmp(buf,"quit",4)==0){ printf("%d已退出聊天室\n",q); close(q); break; } printf("%d说:%s\n",q,buf); sprintf(mass,"%d说:%s",q,buf); int j=0; for(j=0;j<num;j++){ if(q-4!=j) send(new_fd[j],mass,60,0); } //将某个客户端的信息发送给其它客户端 bzero(buf,30); } printf("接受信息结束!\n"); close(q); pthread_exit(NULL); } void revied(int *qian){ int fd; int q=*qian; while(1){ char buf[1024]; char rizhi[100]; int fang; int len; len=sizeof(struct sockaddr); bzero(buf,1025); time_t t; t=time((time_t *) 0); //得到系统时间 if((fang=accept(q,(struct sockaddr *)&itaddr,&len))<0){ //接收来自客户端的连接申请 printf("accept error!\n"); exit(1); } else printf("server:gor connection from %s ,port %d,socket %d ,time:%s\n",inet_ntoa(itaddr.sin_addr),ntohs(itaddr.sin_port),fang, ctime(&t)); //打印出客户端连接信息 //将信息写入文件 sprintf(rizhi,"the %d user connection from %s ,port %d,socket %d ,time:%s\n",num+1,inet_ntoa(itaddr.sin_addr),ntohs(itaddr.sin_port),fang, ctime(&t)); fd =open("rizhi.txt",O_RDWR|O_CREAT, S_IRWXU); lseek(fd,0,SEEK_END); write(fd,rizhi,strlen(rizhi)); close(fd); new_fd[num]=fang; num++; printf("连接了%d用户\n",num); pthread_t sent; pthread_create(&sent,NULL,(void*)sended,&fang); //线程sended函数 sleep(0.2); } close(q); pthread_exit("线程安全退出!\n"); } int main(){ int i=1; int lian; int pid,len; char buf[1024]; pthread_t revi;//声明线程ID printf("Socket...\n"); lian=socket(AF_INET, SOCK_STREAM, 0); /* 创建套接字完成连接, 第一个参数为地址族,也就是ip地址类型,AF_INET表示地址类型为ipv4 第二个参数为数据传输方式/套接字类型,SOCK_STREAM表示流格式套接字/面向连接的套接字 第三个参数为传输协议,设为0,则系统会自动推演该使用什么传输协议 socket()函数返回文件描述符,唯一标识套接字 */ if(lian<0){ printf("%s\n","socket error!"); exit(1); } printf("Bind...\n"); myaddr.sin_family=AF_INET; myaddr.sin_port=htons(8088); //初始化sockaddr_in结构体参数 //sin_port存储端口号 //htons()将本地字节顺序转换为网络字节顺序 inet_aton(("127.0.0.1"),(struct in_addr*)&myaddr.sin_addr.s_addr); //inet_aton,将一个字符串ip转换为网络序列ip地址 if(bind(lian,(struct sockaddr*)&myaddr,sizeof(myaddr))<0) //bind(),创建本地捆绑 { printf("Bind failed.\n"); exit(1); } printf("listen...\n"); listen(lian,5); //linten()创建套接口并监听申请的连接 pthread_create(&revi,NULL,(void*)revied,&lian); /*建立线程 第一个参数为指向线程标识符的指针 第二和参数设置线程属性 第三个参数为线程运行函数的起始地址 第四个参数为该运行函数的参数 */ while(1){ int j=0; char massage[30]; char ass[60]; scanf("%s",&massage); sprintf(ass,"服务器说:%s",massage); if(strncasecmp("quit",massage,4)==0){ printf("即将退出!\n"); break; } if(num<=0)printf("没有客户端连接!\n"); else{ for(j=0;j<num;j++){ int ss=send(new_fd[j],ass,60,0); } //服务器的自己写的信息发送给客户端 } sleep(0.5); } pthread_join(revi,NULL); //等待revi线程结束之后,主线程才能结束 close(lian); return 0; } ```
Door Repairing 的计算问题
Problem Description Once upon a time, there was a famous university called Famous University. As thousands of students studied and lived in FU, a gigantic residential building was built, which is called 'B37'. All students lived in B37 happily. After decades, FU is still as famous as it had been in the past; however, the students living in it are now unhappy, because B37 is too old. Although the door of the building looks fine, it can be easily broken when being opened by some careless student too forcefully. So, YY, the accommodation officer of B37, is facing an extremely serious problem. With some mysterious methods, YY has predicted that exactly N students will enter or exit B37 during the next term. Unfortunately he doesn't know who the careless ones are, so he assumes that every student opening the door has a probability of P percent to be a careless one. When the door is broken by some careless guy, YY may repair it immediately or after some time, with a cost of A yuan. Unfortunately when a student goes through the door and finds it already broken and not repaired, he will report it to the headmaster, and YY will be subject to a fine of B yuan. The door is in good condition before the term begins, and will be repaired by the university after the term ends, so YY can leave the door unrepaired at the end of the term. Being good at mathematics, YY has made a strategy, to decide when to and when not to repair the door, in order to minimize his expense. Please write a program to calculate the expectation of his expense. Input The input consists of multiple test cases. For each test case, there is one line containing four non-negative integers N, P, A, B described as above, with 0<=N<=100000, 0<=P<=100, 0<=A<=100, 0<=B<=100. End of input is indicated by a line consisting of four zeros. Output For each test case, output one line containing the expectation of YY's minimal expense. Your answer should be rounded to 4 digits after the decimal point. Sample Input 10 100 0 1 10 100 1 0 2 50 2 1 0 0 0 0 Sample Output 0.0000 0.0000 0.5000
Door Repairing 程序的编写
Problem Description Once upon a time, there was a famous university called Famous University. As thousands of students studied and lived in FU, a gigantic residential building was built, which is called 'B37'. All students lived in B37 happily. After decades, FU is still as famous as it had been in the past; however, the students living in it are now unhappy, because B37 is too old. Although the door of the building looks fine, it can be easily broken when being opened by some careless student too forcefully. So, YY, the accommodation officer of B37, is facing an extremely serious problem. With some mysterious methods, YY has predicted that exactly N students will enter or exit B37 during the next term. Unfortunately he doesn't know who the careless ones are, so he assumes that every student opening the door has a probability of P percent to be a careless one. When the door is broken by some careless guy, YY may repair it immediately or after some time, with a cost of A yuan. Unfortunately when a student goes through the door and finds it already broken and not repaired, he will report it to the headmaster, and YY will be subject to a fine of B yuan. The door is in good condition before the term begins, and will be repaired by the university after the term ends, so YY can leave the door unrepaired at the end of the term. Being good at mathematics, YY has made a strategy, to decide when to and when not to repair the door, in order to minimize his expense. Please write a program to calculate the expectation of his expense. Input The input consists of multiple test cases. For each test case, there is one line containing four non-negative integers N, P, A, B described as above, with 0<=N<=100000, 0<=P<=100, 0<=A<=100, 0<=B<=100. End of input is indicated by a line consisting of four zeros. Output For each test case, output one line containing the expectation of YY's minimal expense. Your answer should be rounded to 4 digits after the decimal point. Sample Input 10 100 0 1 10 100 1 0 2 50 2 1 0 0 0 0 Sample Output 0.0000 0.0000 0.5000
为什么在codeblocks里运行正常的程序,在devc++中却出现[Error] ld returned 1 exit status?
我照着教材在dev c++中打了一个自定义数组的库,第一次对头文件点编译图标毫无反应,对cpp文件点运行说源文件未编译。我只好把dev c++卸载了重装。 第二次再对头文件点编译无误。但对实现头文件的cpp点编译报[Error] ld returned 1 exit status。对应用的cpp点编译也是同一个错,点运行还是说源文件未编译。 我把相同的代码复制到codeblocks里,完全正常。 代码应该没问题。因为从没运行成功过,所以也不存在后台运行未关闭。我的电脑也没有装杀毒软件。马上机考只能用dev c++,但我实在不知道问题出在哪。求各位大神帮帮小弟! ![图片说明](https://img-ask.csdn.net/upload/202001/03/1578045503_233989.png) 代码如下 array.h ``` #ifndef _array_h #define _array_h struct doublearray { int low,high; double *storage; }; bool initialize(doublearray &arr,int low,int high); bool insert(const doublearray &arr,int index,double value); bool fetch(doublearray &arr,int index,double &value); void cleanup(const doublearray &arr); #endif ``` array.cpp ``` #include <iostream> using namespace std; #include "array.h" bool initialize(doublearray &arr,int low,int high) { arr.low=low; arr.high=high; arr.storage=new double[high-low+1]; if(arr.storage!=NULL) return true; else return false; } bool insert(const doublearray &arr,int index,double value) { if(index<arr.low||index>arr.high) return false; arr.storage[index-arr.low]=value; return true; } bool fetch(doublearray &arr,int index,double &value) { if(index<arr.low||index>arr.high) return false; value=arr.storage[index-arr.low]; return true; } void cleanup(const doublearray &arr) { if(arr.storage) delete []arr.storage; } ``` arrayapply.cpp ``` #include "array.h" #include <iostream> using namespace std; int main() { doublearray array; double value; int low,high; cout<<"low high"<<endl; cin>>low>>high; if(!initialize(array,low,high)) { cout<<"get space failed"<<endl; return 1; } for(int i=low;i<=high;i++) { cout<<"array["<<i<<"]= "<<endl; cin>>value; insert(array,i,value); } int j; cout<<"第几个元素?"<<endl; cin>>j; if(fetch(array,j,value)) cout<<"array["<<j<<"]= "<<value<<endl; else cout<<"下标越界"<<endl; cleanup(array); return 0; } ```
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
redis分布式锁,面试官请随便问,我都会
文章有点长并且绕,先来个图片缓冲下! 前言 现在的业务场景越来越复杂,使用的架构也就越来越复杂,分布式、高并发已经是业务要求的常态。像腾讯系的不少服务,还有CDN优化、异地多备份等处理。 说到分布式,就必然涉及到分布式锁的概念,如何保证不同机器不同线程的分布式锁同步呢? 实现要点 互斥性,同一时刻,智能有一个客户端持有锁。 防止死锁发生,如果持有锁的客户端崩溃没有主动释放锁,也要保证锁可以正常释...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
Python 编程开发 实用经验和技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法和技巧,包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等,会持续更新......
YouTube排名第一的励志英文演讲《Dream(梦想)》
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
Java世界最常用的工具类库
Apache Commons Apache Commons有很多子项目 Google Guava 参考博客
相关热词 c#选择结构应用基本算法 c# 收到udp包后回包 c#oracle 头文件 c# 序列化对象 自定义 c# tcp 心跳 c# ice连接服务端 c# md5 解密 c# 文字导航控件 c#注册dll文件 c#安装.net
立即提问

相似问题

1
汇编编写的一copy文件程序,DOXBOX运行,输入文件路径及名时总显示找不到文件,求大佬帮忙运行解决一下。
3
IDEA中debug不报错run运行java程序报错Process finished with exit code -1073741819 (0xC0000005)
0
ros调用笔记本自带的摄像头,出现找不到video0问题
1
anconda更新后出现OSError[Winerror 126]找不到指定模块该如何解决?
1
LNK2005和LNK1169同时出现,但找不到重复变量。
2
python里面exit()、、、、、
0
Huson's Adventure Island怎么用代码实现的呢
0
信号量一小段学习代码,看不懂输出,求教
1
安装pycocotools提示:cl.exe failed with exit status 2
2
要求在堆空间分配5个整型变量空间,分别存放100,200,300,400,500,要求把这个五个数倒序输出,即输出500,400,300,200,100。(要求使用new和delete操作符分配和回收堆空间)下面程序错那了?
1
Java 电本系统,按照电话号码查询 查不到人求解决!!!
1
Java如何设计画圆程序,要求在画圆区域画圆,并能设置圆的颜色及是否填充圆的内部。
1
k8s的dns解析不到问题,安装redis时nslookup redis-app-0.redis-service错误
1
《C Primer Plus》13.11.12题目
2
maven项目创建失败,有IDEA错误日志但还是找不到问题根源
1
python conda install xxx 报错 找不到指定模块
1
pycharm运行pyqt5报错‘finished with exit code -1073740791 (0xC0000409)
1
这个python程序为什么执行不出来,以Transfer类为函数的主体
1
怎么把这个程序进行实例化并最终执行出来?
2
Python如何对这个程序进行实例化并正确输出?