c++学习问题汇总

docker: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.:
出现这个说明需要登陆,
docker: Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified.
说明需要重启

 


 

 

 命令写在后面执行后立刻退出,不写交互模式;

Errors were encountered while processing

cd /var/lib/dpkg
sudo mv info info.bak
sudo mkdir info
sudo apt-get update

这样可以实现两个数字交换
void swap(int &a,int &b){
int temp=a;
a=b;
b=temp;

}


int main() {


int x=4,y=1;
swap(x,y);
std::cout<< x<<std::endl;
std::cout<<y<<std::endl;

这样也可以

 

 

*只对后面一个起作用,

 

using namespace std;
void swap(int &a,int &b){
int temp=a;
a=b;
b=temp;

}


int main() {


int x=4,y=1;
int * px=&x,*py=&y;
swap(px,py);
std::cout<< x<<std::endl;
std::cout<<y<<std::endl;

}

这样不会报错,但是不起作用
void swap(int *a,int *b){
int *temp=a;
a=b;
b=temp;

}


int main() {


int x=4,y=1;
int * px=&x,*py=&y;
swap(px,py);
std::cout<< x<<std::endl;
std::cout<<y<<std::endl;

}


即使函数换成了指针也不起作用

 

 

在没有声明的情况下不能把函数写在main后面,但是前面可以;

double sqrt(double f=33){
return f*f;
}
int main() {

std::cout<<sqrt()<<std::endl;
std::cout<<sqrt(8)<<std::endl;

}
可以把默认值直接写在函数定义;

 

 

可以把double和int混用,都可以自动转换;

 

 

 

 

未初始化的double的值很奇怪;

 

 

返回引用不能return一个表达式;

 

 如果返回常数的引用就可以;

 

 

 

 

 

 

 

 

 #include <string.h>

必须要。h文件才能使用strlen函数

 

 

 

 

 

报错,升级一下pip

Command "c:\users\administrator\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-m_b9ifz1\\sip\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Administrator\AppData\Local\Temp\pip-record-rh4c3gr2\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Administrator\AppData\Local\Temp\pip-install-m_b9ifz1\sip\

--------------------------------------

 

libGL.so.1: cannot open shared object file: No such file or directory

pip install opencv-python-headless






 

posted on   shenhshihao  阅读(34)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示