-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Level 1 finished #1
base: master
Are you sure you want to change the base?
Changes from 3 commits
94a14bb
60d13fe
3c7488f
4dc3ae2
0592d62
c3555d5
9bb62ad
7f0ab39
e5833d3
4caca54
7e7d3ec
56b8ae4
b461115
9c5cb84
831b1e0
89a45c5
6fb3ce6
e37dfd3
b5e2825
f03ae7f
3670711
7d470ee
931d50e
9462256
5978060
f52e334
d03cb10
7eac2a3
29585be
5fd78a5
b107e3e
a465ec4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{//这个大括号里是我们的‘调试(Debug)’配置 | ||
"name": "Debug", // 配置名称 | ||
"type": "cppdbg", // 配置类型,cppdbg对应cpptools提供的调试功能;可以认为此处只能是cppdbg | ||
"request": "launch", // 请求配置类型,可以为launch(启动)或attach(附加) | ||
"program": "${fileDirname}\\bin\\${fileBasenameNoExtension}.exe", // 将要进行调试的程序的路径 | ||
"args": [], // 程序调试时传递给程序的命令行参数,这里设为空即可 | ||
"stopAtEntry": false, // 设为true时程序将暂停在程序入口处,相当于在main上打断点 | ||
"cwd": "${fileDirname}", // 调试程序时的工作目录,此处为源码文件所在目录 | ||
"environment": [], // 环境变量,这里设为空即可 | ||
// "console":"externalConsole", | ||
"externalConsole": true, // 为true时使用单独的cmd窗口,跳出小黑框;设为false则是用vscode的内置终端,建议用内置终端 | ||
"internalConsoleOptions": "neverOpen", // 如果不设为neverOpen,调试时会跳到“调试控制台”选项卡,新手调试用不到 | ||
"MIMode": "gdb", // 指定连接的调试器,gdb是minGW中的调试程序 | ||
"miDebuggerPath": "d:\\mingw64\\bin\\gdb.exe", // 指定调试器所在路径,如果你的minGW装在别的地方,则要改成你自己的路径,注意间隔是\\ | ||
"preLaunchTask": "build" // 调试开始前执行的任务,我们在调试前要编译构建。与tasks.json的label相对应,名字要一样 | ||
}] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"files.associations": { | ||
"*.vue": "vue", | ||
"*.wpy": "vue", | ||
"*.wxml": "html", | ||
"*.wxss": "css", | ||
"iostream": "cpp" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{//这个大括号里是‘构建(build)’任务 | ||
"label": "build", //任务名称,可以更改,不过不建议改 | ||
"type": "shell", //任务类型,process是vsc把预定义变量和转义解析后直接全部传给command;shell相当于先打开shell再输入命令,所以args还会经过shell再解析一遍 | ||
"command": "g++", //编译命令,这里是gcc,编译c++的话换成g++ | ||
"args": [ //方括号里是传给gcc命令的一系列参数,用于实现一些功能 | ||
"${file}", //指定要编译的是当前文件 | ||
"-o", //指定输出文件的路径和名称 | ||
"${fileDirname}\\bin\\${fileBasenameNoExtension}.exe", //承接上一步的-o,让可执行文件输出到源码文件所在的文件夹下的bin文件夹内,并且让它的名字和源码文件相同 | ||
"-g", //生成和调试有关的信息 | ||
"-Wall", // 开启额外警告 | ||
"-static-libgcc", // 静态链接libgcc | ||
"-fexec-charset=GBK", // 生成的程序使用GBK编码,不加这一条会导致Win下输出中文乱码 | ||
"-std=c11", // 语言标准,可根据自己的需要进行修改,写c++要换成c++的语言标准,比如c++11 | ||
], | ||
"group": { //group表示‘组’,我们可以有很多的task,然后把他们放在一个‘组’里 | ||
"kind": "build",//表示这一组任务类型是构建 | ||
"isDefault": true//表示这个任务是当前这组任务中的默认任务 | ||
}, | ||
"presentation": { //执行这个任务时的一些其他设定 | ||
"echo": true,//表示在执行任务时在终端要有输出 | ||
"reveal": "always", //执行任务时是否跳转到终端面板,可以为always,silent,never | ||
"focus": false, //设为true后可以使执行task时焦点聚集在终端,但对编译来说,设为true没有意义,因为运行的时候才涉及到输入 | ||
"panel": "new" //每次执行这个task时都新建一个终端面板,也可以设置为shared,共用一个面板,不过那样会出现‘任务将被终端重用’的提示,比较烦人 | ||
}, | ||
"problemMatcher": "$gcc" //捕捉编译时编译器在终端里显示的报错信息,将其显示在vscode的‘问题’面板里 | ||
}, | ||
{//这个大括号里是‘运行(run)’任务,一些设置与上面的构建任务性质相同 | ||
"label": "run", | ||
"type": "shell", | ||
"dependsOn": "build", //任务依赖,因为要运行必须先构建,所以执行这个任务前必须先执行build任务, | ||
"command": "${fileDirname}\\bin\\${fileBasenameNoExtension}.exe", //执行exe文件,只需要指定这个exe文件在哪里就好 | ||
"group": { | ||
"kind": "test", //这一组是‘测试’组,将run任务放在test组里方便我们用快捷键执行 | ||
"isDefault": true | ||
}, | ||
"presentation": { | ||
"echo": true, | ||
"reveal": "always", | ||
"focus": true, //这个就设置为true了,运行任务后将焦点聚集到终端,方便进行输入 | ||
"panel": "new" | ||
} | ||
} | ||
|
||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#define WIDTH 60 | ||
#include<iostream> | ||
#include<string> | ||
#include<Windows.h> | ||
#include<stdio.h> | ||
using namespace std; | ||
int main() { | ||
system("mode con cols=60 lines=1"); | ||
char c; | ||
string s; | ||
int n=0,x = 0; | ||
cin >> s; | ||
int len = s.length(); | ||
while (true) { | ||
system("mode con cols=60 lines=1"); | ||
for (int i = 0; i < n; i++)cout << ' '; | ||
cout << s; | ||
Sleep(50); | ||
system("cls"); | ||
x = (x + 1) % (2*(WIDTH-len)); | ||
n = (WIDTH-len-abs(x-WIDTH+len)); | ||
|
||
} | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#define WIDTH 60 | ||
#include<iostream> | ||
#include<string> | ||
#include<Windows.h> | ||
#include<math.h> | ||
#include<stdio.h> | ||
using namespace std; | ||
bool judge(int n) { | ||
bool ex = true; | ||
if (n < 2)return false; | ||
for (int i = 2; i <= sqrt(n); i++) { | ||
if (n % i == 0) ex = false; | ||
} | ||
return ex; | ||
} | ||
int main() { | ||
int x; | ||
cin >> x; | ||
if (judge(x))cout << "yes"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1)if语句的条件判断,和执行分支语句,最好分行写,这样单步跟踪和断点调试的时候更方便 if (judge(x)) {
cout << "yes";
} |
||
else cout << "no"<<endl; | ||
system("pause"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 缩进不对,可以用IDE的自动format处理一下,vs、clion等IDE都有的 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 学到了!!! |
||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.vscode下的文件一般不用提交到github,可以看看.gitignore的用法: https://docs.github.com/cn/github/using-git/ignoring-files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好滴,去看看