Ⅰ 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!");
}
}