當前位置:首頁 » 編程語言 » kn的完全表達式c語言
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

kn的完全表達式c語言

發布時間: 2022-03-12 02:23:05

c語言問題,請詳細解答

輸出結果為:
!knahT
理由如下:
執行fun()函數時:
s[80]儲存字元,n記錄當前字元所在位置。
執行while循環:
getchar()函數逐個獲取字元,存在s數組中,n++,位置+1,直到輸入為回車,即 '\n'時,輸入結束。
此時,n的位置是指向'\n'的。所以-1;
然後逆序輸出。結果為!knahT.
返回主函數,輸出換行。

㈡ 求解C語言,解說一下為什麼這樣可以求出兩個數的最大公約數

求x,y的最大公約數。
當x%y=0,也就是x能被y整除,不執行循環語句,返回值為y,即y是最大公約數
當x%y!=0,執行循環語句。當x<y,p=y,x%y余x賦值給y,即交換x,y的值,使得x>y。
舉例:x=21,y=15;
第一次循環後:x=15,y=6
第一次循環後:x=6,y=3 此時x%y=0 結束循環 即最大公約數為3

㈢ KN和KG的關系怎麼換算

KN代表千牛,KG代表千克,千牛是力的單位,千克是質量單位,不能直接換算。

根據1kN=1000kg X 1m/s^2,地球表面重力加速度為g=9.8m/s^2,所以1噸的質量產生的荷載效

應為9.8kN=1000kg X g。

因此,在地球表面,1kN=(1000kg /9.8)X g,1千牛約相當於102千克的物體的重力。

(3)kn的完全表達式c語言擴展閱讀

千牛是工程設計、力學計算中的常用單位,是力的單位,而千克是質量單位,不能與質量直接換算。

千克是公制計量單位,一千克等於一公斤,合我國二市斤。

千克復數形式:Kilogrammes

國際單位制中米、千克、秒制的質量單位,也是國際單位制的7個基本單位之一。法國大革命後,由

法國科學院制定。原計劃製作的是新頒布的質量的主單位——克的標准器,但因為當時工藝和測量

技術所限,故製作了質量是克的1000倍的標准器,即千克標准原器——這也是國際單位制中質量單

位是千克而不是克的原因。

㈣ 簡單的C語言問題

for(i=0;( c=str[i] )!='\0';i++ ) //賦值操作符=優先順序最低,所以要括起來才行!

㈤ 怎樣用c語言寫

染色法。設置染色數組array
初始顏色為各元素各自顏色,即array[i] = i;
在讀入學生團體的時候進行「著色」。目的是把學生團體涉及的學生顏色染成同一種顏色。
在染色時發現別的團體的顏色,就把該兩種團體的顏色合並。
最後,查找目標編號的學生顏色,在數組中統計該顏色的所有學生即可。
#include <stdio.h>
void color (int * array, int n, int color1, int color2)
{
int i;
for (i = 0; i < n; i++)
if (array[i]==color1)
array[i]=color2;
}
void main()
{
int n, k;
n = 100;
int array [100];
// 初始化染色數組
int i, j, m;
for (i = 0; i < 100; i++)
array [i] = i;
scanf("%d", &k);
int kn;
for (i = 0; i < k; i++)
{
scanf ("%d",&kn);
for (j = 0; j < kn; j++)
{
scanf( "%d", &m);
color (array, n, array[m], n+i);
}
}
scanf ("%d", &j);
for (i = 0; i < 100; i++)
if (array[i]==array[j])
printf ("%d ", i);
printf ("\n");
}

㈥ C語言問題!

Misplaced decimal point
此處不應出現小數點
Misplaced elif directive
不應編譯預處理elif
Misplaced else
此處不應出現else
Misplaced else directive
此處不應出現編譯預處理else
Misplaced endif directive
此處不應出現編譯預處理endif
Must be addressable
必須是可以編址的
Must take address of memory location
必須存儲定位的地址
No declaration for function ''xxx''
沒有函數xxx的說明
No stack
缺少堆棧
No type information
沒有類型信息
Non-portable pointer assignment
不可移動的指針(地址常數)賦值
Non-portable pointer comparison
不可移動的指針(地址常數)比較
Non-portable pointer conversion
不可移動的指針(地址常數)轉換
Not a valid expression format type
不合法的表達式格式
Not an allowed type
不允許使用的類型
Numeric constant too large
數值常太大
Out of memory
內存不夠用
Parameter ''xxx'' is never used
能數xxx沒有用到
Pointer required on left side of ->
符號->的左邊必須是指針
Possible use of ''xxx'' before definition
在定義之前就使用了xxx(警告)
Possibly incorrect assignment
賦值可能不正確
Redeclaration of ''xxx''
重復定義了xxx
Redefinition of ''xxx'' is not identical
xxx的兩次定義不一致
Register allocation failure
寄存器定址失敗
Repeat count needs an lvalue
重復計數需要邏輯值
Size of structure or array not known
結構體或數給大小不確定
Statement missing ;
語句後缺少";"
Structure or union syntax error
結構體或聯合體語法錯誤
Structure size too large
結構體尺寸太大
Sub scripting missing ]
下標缺少右方括弧
Superfluous & with function or array
函數或數組中有多餘的"&"
Suspicious pointer conversion
可疑的指針轉換
Symbol limit exceeded
符號超限
Too few parameters in call
函數調用時的實參少於函數的參數不
Too many default cases
Default太多(switch語句中一個)
Too many error or warning messages
錯誤或警告信息太多
Too many type in declaration
說明中類型太多
Too much auto memory in function
函數用到的局部存儲太多
Too much global data defined in file
文件中全局數據太多
Two consecutive dots
兩個連續的句點
Type mismatch in parameter xxx
參數xxx類型不匹配
Type mismatch in redeclaration of ''xxx''
xxx重定義的類型不匹配
Unable to create output file ''xxx''
無法建立輸出文件xxx
Unable to open include file ''xxx''
無法打開被包含的文件xxx
Unable to open input file ''xxx''
無法打開輸入文件xxx
Undefined label ''xxx''
沒有定義的標號xxx
Undefined structure ''xxx''
沒有定義的結構xxx
Undefined symbol ''xxx''
沒有定義的符號xxx
Unexpected end of file in comment started on line xxx
從xxx行開始的註解尚未結束文件不能結束
Unexpected end of file in conditional started on line xxx
從xxx 開始的條件語句尚未結束文件不能結束
Unknown assemble instruction
未知的匯編結構
Unknown option
未知的操作
Unknown preprocessor directive: ''xxx''
不認識的預處理命令xxx
Unreachable code
無路可達的代碼
Unterminated string or character constant
字元串缺少引號
User break
用戶強行中斷了程序
Void functions may not return a value
Void類型的函數不應有返回值
Wrong number of arguments
調用函數的參數數目錯
''xxx'' not an argument
xxx不是參數
''xxx'' not part of structure
xxx不是結構體的一部分
xxx statement missing (
xxx語句缺少左括弧
xxx statement missing )
xxx語句缺少右括弧
xxx statement missing ;
xxx缺少分號
xxx'' declared but never used
說明了xxx但沒有使用
xxx'' is assigned a value which is never used
給xxx賦了值但未用過
Zero length structure
結構體的長度為零

Ambiguous operators need parentheses
不明確的運算需要用括弧括起
Ambiguous symbol ''xxx''
不明確的符號
Argument list syntax error
參數表語法錯誤
Array bounds missing
丟失數組界限符
Array size toolarge
數組尺寸太大
Bad character in paramenters
參數中有不適當的字元
Bad file name format in include directive
包含命令中文件名格式不正確
Bad ifdef directive synatax
編譯預處理ifdef有語法錯
Bad undef directive syntax
編譯預處理undef有語法錯
Bit field too large
位欄位太長
Call of non-function
調用未定義的函數
Call to function with no prototype
調用函數時沒有函數的說明
Cannot modify a const object
不允許修改常量對象
Case outside of switch
漏掉了case 語句
Case syntax error
Case 語法錯誤
Code has no effect
代碼不可述不可能執行到
Compound statement missing{
分程序漏掉"{"
Conflicting type modifiers
不明確的類型說明符
Constant expression required
要求常量表達式
Constant out of range in comparison
在比較中常量超出范圍
Conversion may lose significant digits
轉換時會丟失意義的數字
Conversion of near pointer not allowed
不允許轉換近指針
Could not find file ''xxx''
找不到XXX文件
Declaration missing ;
說明缺少";"
Declaration syntax error
說明中出現語法錯誤
Default outside of switch
Default 出現在switch語句之外
Define directive needs an identifier
定義編譯預處理需要標識符
Division by zero
用零作除數
Do statement must have while
Do-while語句中缺少while部分
Enum syntax error
枚舉類型語法錯誤
Enumeration constant syntax error
枚舉常數語法錯誤
Error directive :xxx
錯誤的編譯預處理命令
Error writing output file
寫輸出文件錯誤
Expression syntax error
表達式語法錯誤
Extra parameter in call
調用時出現多餘錯誤
File name too long
文件名太長
Function call missing )
函數調用缺少右括弧
Fuction definition out of place
函數定義位置錯誤
Fuction should return a value
函數必需返回一個值
Goto statement missing label
Goto語句沒有標號
Hexadecimal or octal constant too large
16進制或8進制常數太大
Illegal character ''x''
非法字元x
Illegal initialization
非法的初始化
Illegal octal digit
非法的8進制數字
Illegal pointer subtraction
非法的指針相減
Illegal structure operation
非法的結構體操作
Illegal use of floating point
非法的浮點運算
Illegal use of pointer
指針使用非法
Improper use of a typedefsymbol
類型定義符號使用不恰當
In-line assembly not allowed
不允許使用行間匯編
Incompatible storage class
存儲類別不相容
Incompatible type conversion
不相容的類型轉換
Incorrect number format
錯誤的數據格式
Incorrect use of default
Default使用不當
Invalid indirection
無效的間接運算
Invalid pointer addition
指針相加無效
Irrecible expression tree
無法執行的表達式運算
Lvalue required
需要邏輯值0或非0值
Macro argument syntax error
宏參數語法錯誤
Macro expansion too long
宏的擴展以後太長
Mismatched number of parameters in definition
定義中參數個數不匹配
Misplaced break
此處不應出現break語句
Misplaced continue
此處不應出現continue語句

㈦ 求C語言演算法

#include "stdafx.h"
#include "stdio.h"

int a[]={350,440,550,700,880,1100,1400,1760,2200,2800,3520,4400,5600,7040,8800,11200};
int sum=0;
int kn=1;
int end[16];
int main(int argc, char* argv[])
{
void Find(int n,int x,int i,int kj);

int n,x;
printf("請輸入n和x---n為相加數字的個數范圍,x為相加數字的所的值:");
scanf("%d,%d",&n,&x);

Find(n,x,1,0);

return 0;
}

void Find(int n,int x,int i,int kj)
{

if(i>n)
return;
int j;
for(j=kj;j<16;j++)
{
sum+=a[j];
end[i-1]=a[j];

if(sum<x)
{
Find(n,x,i+1,j);
sum-=a[j];
}
else if(sum==x)
{

printf("第%d組解為:%d=%d",kn,sum,end[0]);
kn++;
for(int k=1;k<i;k++)
{
printf("+%d",end[k]);
}
printf("\n");
sum-=a[j];
break;
}
else
{
sum-=a[j];
break;
}

}
}

OK 沒注釋..有問題 可以發我消息

㈧ n個結點的無向完全圖Kn的邊數為() ,歐拉圖的充要條件是()

n個結點的無向完全圖Kn的邊數為(n*(n-1)/2) ,歐拉圖的充要條件是(最多兩個奇數度的節點)。

頂點為n,每個點可與其它n-1個點相連,共有n*(n-1),但是每條線均被計算了2次(比如從A到B和從B連到A是一樣的),再除以2,即n*(n-1)/2。

歐拉迴路要求所有頂點都是偶數的度,也就是有進就有出。歐拉路徑,不是迴路,起點終點可以不重合,所以對於起點來說,出度比入度大1,而終點反之。至於其他的頂點,全部是中間節點,有入必有出。無向圖為偶數度,有向圖入度等於出度。

(8)kn的完全表達式c語言擴展閱讀

(1)無向邊的表示

無向圖中的邊均是頂點的無序對,無序對通常用圓括弧表示。

【例】無序對(vi,vj)和(vj,vi)表示同一條邊。

(2)無向圖的表示

【例】下面(b)圖中的G2和(c)圖中的G3均是無向圖,它們的頂點集和邊集分別為:

V(G2)={v1,v2,v3,v4}

E(G2)={(vl,v2),(v1,v3),(v1,v4),(v2,v3),(v2,v4),(v3,v4)}

V(G3)={v1,v2,v3,v4,v5,v6,v7}

E(G3)={(v1,v2),(vl,v3),(v2,v4),(v2,v5),(v3,v6),(v3,v7)}

㈨ 1. 設完全圖Kn有n個結點(n³2),m條邊,當( )時,Kn中存在歐拉迴路. A. m為奇數 B. n為偶數 C. n為

1. Kn每個結點的度都為n-1,所以若存在歐拉迴路則n-1必為偶數。n必為奇數。選C。
2. 由歐拉公式直接得出 r = e-v+2。選A。
3. 直接根據強連通的定義選擇A。
5. 無向樹邊比點少1,所以T的邊數為7。選B。
6. 度數之和為邊數的二倍。除了給出的3個結點以外,其餘5個結點度數和為5。所以5個結點都是樹葉。選B。
7. D
8. C