• C语言???


    大学被迫学C。
    0.没有using namespace std;
    1.C的文件输入输出

    #include 
    #include 
    #include 
    int i,j,k,m,n,o,p,l,s,t;
    int main()
    {
        FILE *fin=fopen("test.txt","r+");
        FILE *fout=fopen("test.out","w+");
        fscanf(fin,"%d",&n);
        for (i=1;i<=n;i++) fscanf(fin,"%d",&t),s+=t;
        fprintf(fout,"%d\n",s+1);
        fclose(fin);fclose(fout);
        return 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    2.codeblocks使用
    如何打开一个项目
    debug教程
    3.vscode使用方法
    看这里
    不显示终端被占用

    在这里插入代码片//tasks.json 
    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558 
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "type": "shell",
                "label": "g++.exe build active file", //这里注意一下,见下文
                "command": "D:\\x86_64-8.1.0-release-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
                "args": [
                    "-g",
                    "${file}",
                    "-o",
                    "${fileDirname}\\${fileBasenameNoExtension}.exe"
                ],
                "options": {
                    "cwd": "D:\\x86_64-8.1.0-release-win32-seh-rt_v6-rev0\\mingw64\\bin"
                },
                "problemMatcher": [
                    "$gcc"
                ],
                "group": {
    				"kind": "build",
    				"isDefault": true
    			},
    			"presentation": {
    				"echo": true,
    				"reveal": "always",
    				"focus": false,
    				"panel": "new", //这里shared表示共享,改成new之后每个进程创建新的端口
    				"showReuseMessage": true,
    				"clear": false
    			}
            }
        ]
    }
    
    • 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
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    //launch.json文件的内容
    {
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(gdb) Launch",
                "preLaunchTask": "g++.exe build active file",//调试前执行的任务,就是之前配置的tasks.json中的label字段
                "type": "cppdbg",//配置类型,只能为cppdbg
                "request": "launch",//请求配置类型,可以为launch(启动)或attach(附加)
                "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",//调试程序的路径名称
                "args": [],//调试传递参数
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole": true,//true显示外置的控制台窗口,false显示内置终端
                "MIMode": "gdb",
                "miDebuggerPath": "D:/x86_64-8.1.0-release-win32-seh-rt_v6-rev0/mingw64/bin/gdb.exe",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
            }
        ]
    }
    
    • 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
    //c_cpp_properties.json
    {
        "configurations": [
            {
                "name": "Win32",
                "includePath": [
                    "${workspaceFolder}/**"
                ],
                "defines": [
                    "_DEBUG",
                    "UNICODE",
                    "_UNICODE"
                ],
                "compilerPath": "D:/x86_64-8.1.0-release-win32-seh-rt_v6-rev0/mingw64/bin/g++.exe",
                "cStandard": "c11",
                "cppStandard": "c++17",
                "intelliSenseMode": "gcc-x64"
            }
        ],
        "version": 4
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
  • 相关阅读:
    SQL零基础入门教程,贼拉详细!贼拉简单! 速通数据库期末考!(十)
    【Chrome】使用k8s、docker部署无头浏览器Headless,Java调用示例
    【牛客网】BC146 添加逗号
    万恶的 eval() ?
    3.3 C++高级编程_函数模板_引入
    【设计模式】【创建型5-2】【工厂方法模式】
    计算机毕业设计ssm+vue+elementUI基于web的邮票鉴赏系统及实现
    Kubernetes集群中配置Ingress支持HTTPS访问(一):cfssl
    QT第三方库加载pro解读
    洛谷 P5536 【XR-3】核心城市(贪心 + 树形 dp 寻找树的中心)
  • 原文地址:https://blog.csdn.net/wangyuda123456789/article/details/132707734