c++
我是一只代码狗
学习it我总结了五个字,听,问,看,想,敲
展开
-
创建一个namespace xx的类 报黄线
加上这些sheng随便写的#ifndef sheng#define shengnamespace xxx{}#endif //sheng转载 2020-05-26 14:50:28 · 173 阅读 · 0 评论 -
解决:LNK2005 “int * __cdecl SortTestHelper::generateRandomArray(int,int,int)”
严重性 代码 说明 项目 文件 行 禁止显示状态错误 LNK2005 “int * __cdecl SortTestHelper::generateRandomArray(int,int,int)” (?generateRandomArray@SortTestHelper@@YAPAHHHH@Z) 已经在 ConsoleApplication2.obj 中定义解决办法:删除掉和.h相关的.cpp文件...转载 2020-05-26 14:46:49 · 387 阅读 · 0 评论 -
c++选择排序,按照name先排序 然后 分数 最小的在前
#pragma once#include <string.h>#include <iostream>using namespace std;class Student{public: Student(string name,int fen) { this->name = name; this->fen = fen; } friend ostream& operator<<(...转载 2020-05-26 13:46:25 · 196 阅读 · 0 评论 -
错误 C2678二进制“大于号” 没有找到接受“T”类型的左操作数的运算符(或没有可接受的转换)
if (arr[j]> arr[minIndex]){ }> 要改为<if (arr[j]<arr[minIndex]){ }转载 2020-05-26 13:21:37 · 679 阅读 · 0 评论 -
解决vs2019 在cmd输入 qmake -tp vc dm01.pro 这样的命令
报下面的错误Project ERROR: Cannot run compiler 'cl'. Output:======================================Maybe you forgot to setup the environment?设置环境变量vs2019的目录是这个地址在path里面编辑这个 保存后再重新打开cmd就会成功C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\T转载 2020-05-25 15:48:37 · 765 阅读 · 0 评论 -
解决 “ostream”: 不允许在数据声明中使用“friend”
在顶部加上这2行代码#include <iostream>using namespace std;转载 2020-05-20 15:43:31 · 2049 阅读 · 3 评论 -
解决 c++中 cout 显示double 只显示6位的长度
//在头部引用这个#include <iomanip>using namespace std;int main(){//cout默认double 只显示6位数字 可以用下面2个方式显示更多的数字double a = 32.1415926789;//显示所有数字为9包含小数点前面的数字cout << setprecision(9) << a << endl;//保留小数点后9位 组合起来cout<< setiosflags(ios转载 2020-05-15 12:05:01 · 5790 阅读 · 0 评论