This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 变量的作用域 | |
#include <stdio.h> | |
int count; // this is a global variable | |
void head1(); | |
void head2(); | |
void head3(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 用递归法计算n! | |
#include <stdio.h> | |
long factorial (int n) | |
{ | |
long f; | |
if(n <= 1) f = 1; | |
else f = n * factorial(n - 1); | |
return(f); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 根据用户掷色子的值,显示相应个数的星号* | |
#include <stdio.h> | |
void showone (); | |
void showtwo (); | |
void showthree (); | |
void showfour (); | |
void showfive (); | |
void showsix (); // 色子数为1~6的情况分别以星号表示 | |
int randn(); //随机摇出色子点数 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 有10个整数组成一个数组a,其中整数x出现了若干次,删除多余的x | |
只保留一个x,显示删除了的x的个数和最后的数组a */ | |
//假如要删除1 | |
#include <stdio.h> | |
#define N 100 | |
void main() | |
{ | |
int x, i, count = 0; | |
int a[10] = {5, 1, 2, 1, 1, 4, 3, 1, 1, 6}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"cmd": ["gcc", "${file}", "-o", "${file_path}/${file_base_name}.exe"], | |
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", | |
"working_dir": "${file_path}", | |
"selector": "source.c, source.c++", | |
"variants": | |
[ | |
{ | |
"name": "Run", |
NewerOlder