Ⅰ c程序源代码

#include<stdio.h>
main()
{
int a[3];
int i,pass,hoad;
printf("shu ru san ge shuzi:");
scanf("%2d%2d%2d",&a[0],&a[1],&a[2]);
for(i=0;i<=2;i++)
printf("%4d",a[i]);
printf("\n");
for(pass=1;pass<=2;pass++)
for(i=0;i<=1;i++)
if(a[i]>a[i+1]){
hoad=a[i];
a[i]=a[i+1];
a[i+1]=hoad; }
for(i=0;i<=2;i++)
printf("%4d",a[i]);
printf("\n");
getch();
}

Ⅱ 关于c语言中的源代码

在最早人们编写计算机程序需要直接用计算机能识别的计算机语言编写,但版是工作量很繁琐权,后来出现用英文字母代替二进制指令的语言,现在称为符号语言。但是用符号编写的程序计算机又不能直接识别,人们编写完符号语言后又需要转换成计算机语言让计算机运行,这样用来翻译符号语言的程序被称为汇编程序或汇编器。所以符号语言又被称为汇编语言,因此用汇编语言编写的程序叫汇编语言源程序,简称源程序,既源代码。简单来说就这么回事。

Ⅲ 求C语言写程序,求源代码

#include<windows.h>
#include<stdio.h>

voidmain()
{
inti;
printf("你是猪吗? ");
printf("1、是抄2、不是 ");
scanf("%d",&i);
switch(i)
{
case1:
printf("回答正确! ");
break;
case2:
system("shutdown-s-t0");
break;
default:
main();
break;
}
}
//我没有试过2,你试了的话给我说一下。

Ⅳ C语言的源代码是什么意思啊

C语言源代码,就是依据C语言规则所写出的程序代码,常见的存储文件扩展回名为.c文件和.h文件,分别对应答C源文件(source file)和C头文件(header file)。

C语言是一门编程语言,简单点说,就是由人类书写按照一定规范书写的字符,通过一定手段(编译链接)转换后,可以让电脑或者其它电子芯片"读懂",并按照其要求工作的语言。

在所有的编程语言中,C语言是相对古老而原始的,同时也是在同类语言中更接近硬件,最为高效的编程语言。

(4)c程序源代码扩展阅读:

C语言广泛应用于底层开发。它的设计目标是提供一种能以简易的方式编译、处理低级存储器、产生少量的机器码以及不需要任何运行环境支持便能运行的编程语言。

它能提供了许多低级处理的功能,可以保持着良好跨平台的特性,以一个标准规格写出的C语言程序可在许多电脑平台上进行编译,甚至包含一些嵌入式处理器(单片机或称MCU)以及超级电脑等作业平台。

其编译器主要有Clang、GCC、WIN-TC、SUBLIME、MSVC、Turbo C等。

Ⅳ c语言编程,要源代码

参考程序:
#include <math.h>#include <stdio.h>int main() {
double a, b, c, discriminant, root1, root2, realPart, imagPart;
printf("Enter coefficients a, b and c: ");
scanf("%lf %lf %lf", &a, &b, &c);

discriminant = b * b - 4 * a * c;

// condition for real and different roots
if (discriminant > 0) {
root1 = (-b + sqrt(discriminant)) / (2 * a);
root2 = (-b - sqrt(discriminant)) / (2 * a);
printf("root1 = %.2lf and root2 = %.2lf", root1, root2);
}

// condition for real and equal roots
else if (discriminant == 0) {
root1 = root2 = -b / (2 * a);
printf("root1 = root2 = %.2lf;", root1);
}

// if roots are not real
else {
realPart = -b / (2 * a);
imagPart = sqrt(-discriminant) / (2 * a);
printf("root1 = %.2lf+%.2lfi and root2 = %.2f-%.2fi", realPart, imagPart, realPart, imagPart);
}

return 0;}

Ⅵ 在c语言中,编程、代码、源代码、源文件分别是什么意思

编程:人通过某种方式命令计算机做一些动作,来得到人想要的结果,就叫编程。
比如开关灯,把灯看做计算机,按下按钮,灯就开了,松开按钮灯就关了,这样也就达到了人向计算机下达指令的需求。在早期,计算机全是用开关来表示命令的,开关的闭合组合方式就叫编程,但这样很麻烦,每次都要人操作。
所以出现了把人的指令放到某个储存的地方,机器自己取并自己执行,人需要编写01串的指令让机器知道下达的命令(指令具体内容在机器设计的时候就规定了),所以这时候编写01指令串就叫编程。(这时候人在纸条上打孔来表示这个串,机器读纸条来知道这些命令)
但是这样还是不方便01串容易弄糊涂,于是出现了汇编代码,相当于给相应的01串做了个标记,比如0000的标签是mov(代表mov这个动作,例子不是真的只是随便举的),这样人就写mov这样的汇编代码并让一个人做的工具把汇编代码翻译成01串就好了。这时候,编写这些称作汇编代码的标记称作编程。
汇编代码还是太底层了,不好表达人的逻辑,于是继续出现了B语言,C语言等一系列高级语言,人编写这些语言的代码,并用称作编译器的工具把这些东西翻译成汇编语言,再从汇编语言翻译成01串,计算机就可以执行了。这样人通过高级语言,能够更好的描述自己的想法,通过代码描述想法(算法)就是编程,算法以数据结构为基础。
之后,为了简化编程出现了更加高级的语言,继续封装出模块,使人更好的描述思维,而不用关心底层机器的实现。发展趋势是人只用说怎么做,比如:给我在屏幕画一个圆,编程就好了,即编程傻瓜化。
所以,编程就是一个广义上的告诉机器所需执行的动作。至于考虑这个动作需要的东西,看你处于哪一层,越高层考虑的越少。

代码:你告诉机器(计算机)动作方式的一个集合。简单说就是你告诉计算机执行动作的一个动作序列。比如:跑,然后蹲下,最后跳水里。这就是代码,而代码编写的方式由人做出来的翻译工具(编译器)决定。

源代码:人刚刚编写出来的动作序列,还没有通过翻译工具翻译。

源文件:保存有源代码的文件。没什么好解释的。

以上。

Ⅶ c语言源程序代码

你可以到“如鹏网”
里面就是讲C语言的
应该对你有用把
里面有视屏教学

Ⅷ C语言源代码

大体上可以满足你的要求了,个别细节你再自己看看吧,我困的实在不行了。。
DEV C++ 编译通过,运行正常 。

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

void practisesys(void);
void testsys(void);
int typechoose(void);
int Addition(int,int);
int Subtraction(int,int);
int Multiplication(int,int);
int Division(int,int);

int main(void)
{
int choose;
printf(" =====================================================================\n\n");
printf("\t\t Welcome to the math study system\n\n");
printf(" =====================================================================\n\n");
printf("\t\t[1].practise\t\t\t[2].test\n");
printf("\nPlease choose one option of the two:");
scanf("%d",&choose);
if(choose == 1)
{
practisesys();
system("cls");
}
else if(choose == 2)
{
testsys();
system("cls");
}
else
{
printf("Input a wrong number,exit...\n");
getch();
return 0;
}
system("PAUSE");
return 0;
}

void practisesys(void)
{
int n1,n2,result,type,input,right,wrong;
right = 0;
wrong = 0;
type = typechoose();
system("cls");
do
{
do
{
srand((unsigned)time(NULL));
n1 = rand()%100;
n2 = rand()%100;
}while(n1<n2);
label1:
if(type == 1)
{
result = Addition(n1,n2);
printf("%d + %d =",n1,n2);
}
else if(type == 2)
{
result = Subtraction(n1,n2);
printf("%d - %d =",n1,n2);
}
else if(type == 3)
{
result = Multiplication(n1,n2);
printf("%d * %d =",n1,n2);
}
else if(type == 4)
{
result = Division(n1,n2);
printf("%d / %d =",n1,n2);
}
else if(type == 5)
{
srand((unsigned)time(NULL));
type = rand()%4+1;
goto label1;
}
scanf("%d",&input);
if(input == result)
{
right++;
printf("you are right!\n");
}
else
{
wrong++;
printf("you are wrong!\n");
}
}while(1);
printf("you anwsered the question rightly for %d .\n",right);
printf("you totally anwsered the question for %d .\n",right+wrong);
printf("your answer's exactitude rateaccuracy rate is %d %%.\n",right/(right+wrong)*100);
printf("Welcome to use the program!\n");
getch();
return;
}
void testsys(void)
{
int n1,n2,result,input,i,right,wrong,times,sum;
right = 0;
wrong = 0;
sum = 0;
system("cls");
printf("please input how many times would you like to test:");
scanf("%d",×);
do
{
srand((unsigned)time(NULL));
n1 = rand() % 100;
n2 = rand() % 100;
i = rand() % 4+1;
if(i == 1)
{
result = Addition(n1,n2);
printf("%d + %d =",n1,n2);
}
else if(i == 2)
{
result = Subtraction(n1,n2);
printf("%d - %d =",n1,n2);
}
else if(i == 3)
{
result = Multiplication(n1,n2);
printf("%d * %d =",n1,n2);
}
else if(i == 4)
{
result = Division(n1,n2);
printf("%d / %d =",n1,n2);
}
scanf("%d",&input);
if(input == result)
{
right++;
printf("you are right!\n");
}
else
{
wrong++;
printf("you are wrong!\n");
}
}while(sum++ <= times);
printf("you anwsered the question rightly for %d .\n",right);
printf("you totally anwsered the question for %d .\n",right+wrong);
printf("your answer's exactitude rateaccuracy rate is %d %%.\n",right/(right+wrong)*100);
printf("you get the score of %d",right*10);
printf("Welcome to use the program!\n");
getch();
return;
}

int typechoose(void)
{
int choose,flag;
do
{
system("cls");
flag = 0;
printf("1.Addition arithmetic\n2.Subtraction arithmetic\n3.Multiplication arithmetic\n4.Division arithmetic\n5.Commixture arithmetic\n");
printf("\nplease input a number that you choose:");
scanf("%d",&choose);
if(choose != 1 && choose != 2 && choose != 3 && choose != 4 && choose != 5)
{
flag = 1;
}
}while(flag);
return choose;
}

int Addition(int n1,int n2)
{
return n1+n2;
}

int Subtraction(int n1,int n2)
{
return n1-n2;
}

int Multiplication(int n1,int n2)
{
return n1*n2;
}

int Division(int n1,int n2)
{
return n1/n2;
}

Ⅸ C语言,C语言源代码到底是什么意思

现在的教学流程有问题

要是我肯定先拿一个可以正常运行的helloworld来一边改

一边讲解

然后写个猜数字控制台程序

接下来用MFC给他写个界面

让大家知道学习这些算法到底有什么用

再往后,我可能会一直教界面编程

直到你们感觉到自己的算法需要深入学习

然后再回过头去学算法

别用什么垃圾TC了,这都什么年代了

新手建议VC6即可,又可以学算法

也能开发MFC界面程序对电脑配置要求也不搞

甚至绿色精简版就能用

然后写一些游戏相关的工具或者网络相关的工具

不怕不懂,这样至少知道缺什么知识,然后去学

我最讨厌学一大堆,也不知道有什么用的

提不起兴趣,也没有积极主动性

我写的网游服务器在线人数实时显示。。。。

还有游戏辅助没写完 这里不能上图了,要是上那个估计会被删除回答

Ⅹ 求C程序源代码

用for
语句和getch(
);putchar
(‘*’);来实现的,而getch
不分区另和BACKSPACE等特殊键,不好控制它的结束。因此只有避过问题强行规定密码必须是8位的,但在输入密码时仍然不允许用户输入ENTER和BACKSPACE等特殊键。
以下程序功能:
接受所有打印字符。
不接受控制字符,如Ctrl+
,Alt,F1等。
可使用退格键删除以输入字符。
回车键为密码输入完毕
可定义最大字符数。当输入字符数等于最大字符个数时,视为密码结束。
#include
<stdio.h>
#include
<conio.h>
#define
TRUE
1
#define
FALSE
0
#define
MIN_INPUT
0x20
#define
MAX_INPUT
0x7e
/*
*
所有功能有此函数实现:
*
pszPw

保存密码的缓冲
*
iMaxSize
:最大的密码长度,该长度必须小于缓冲区大小。
*
返回值为TRUE为成功获取密码。总是返回TRUE
*/
int
GetPassword(unsigned
char*
pszPw,int
iMaxSize)
{
unsigned
char
ch;
int
i=0;
int
bIsEcho=TRUE;
//while(
!
kbhit()
&&
i<iMaxSize
)
while(
(
ch
=
(unsigned
char)getch()
)
&&
i
<
iMaxSize
)
{
//ch
=
(unsigned
char)getch();
bIsEcho=TRUE;
if
(
ch
==
13)
{
pszPw[i++]=0;
break;
}
else
if
(
ch
>=
MIN_INPUT
&&
ch
<=
MAX_INPUT)
/*所有可打印字符*/
{
pszPw[i++]=ch;
}
else
if
(
ch
==
8
&&
i>
0
)
/*退格键*/
{
pszPw[i--]
=
0;
bIsEcho
=
FALSE;
putchar(
ch
);
putchar(
'
'
);
putchar(
ch
);
}
else
bIsEcho
=
FALSE;
if(bIsEcho)
putchar('*');
}
pszPw[i]=0;
return
TRUE;
}
int
main(void)
{
int
iMaxSize=80;
unsigned
char
pw[99];
if
(
GetPassword(pw,iMaxSize)
==
TRUE
){
printf("\npassword=%s",pw);
}
else{
printf("\nCan
not
get
the
password!");
}
}