C語言名企面試題

2021-08-01 02:29:35 字數 1223 閱讀 7683

5位運動員參加了10公尺臺跳水比賽,有人讓他們**比賽結果

a選手說:b第一,我第三。

b選手說:我第二,e第四。

c選手說:我第一,d第二。

d選手說:c最後,我第三。

e選手說:我第四,a第一。

比賽結束後,每位選手都說對了一半,請程式設計確定比賽的名次。

#define _crt_secure_no_warnings 1 

#include

#include

int main()}}

}}

}system("pause");

return

0;}

日本某地發生了一件**案,警察通過排查確定殺人**必為4個嫌疑犯的乙個。以下為4個嫌疑犯的供詞。

a說:不是我。

b說:是c。

c說:是d。

d說:c在胡說

已知3個人說了真話,1個人說的是假話。

現在請根據這些資訊,寫乙個程式來確定到底誰是**。

#define _crt_secure_no_warnings 1 

#include

int main()

if (i == 2)//b說的假

if (i == 3)//c說的假

if (i == 4)//d的說的假

if (a + b + c + d + fd == 1 && fd == d)

}return

0;}

3.在螢幕上列印楊輝三角。

#define _crt_secure_no_warnings 1 

#include

#include

int main()

i = 0;

for (; i < level; i++)

i = 2;

for (; i < level; i++)

}i = 0;

for (; i < level; i++)

for (j = 0; j <= i; j++)

printf("\n");

}printf("\n");

i = 0;

for (; i < level; i++)

free(yanghui);

return

0;}

名企面試題

小公尺 1.設計乙個演算法,把乙個排序二叉樹,轉化成乙個排序的雙向鍊錶,要求不能建立任何新的節點,只調整指標指向。include include include using std cout using std cin using std endl struct bsnode 定義各種用到資料型別 ...

關於C語言的名企面試題

1.編寫 模擬三次密碼輸入的場景 define crt secure no warnings 1 include include int main if i 3 else return 0 2.編寫乙個程式,可以一直接收鍵盤字元,如果是小寫字元就輸出對應的大寫字元,如果接收的是大寫字元,就輸出對應的...

IT名企面試 騰訊筆試題

const的含義及實現機制,比如 const int i,是怎麼做到i只可讀的?const用來說明所定義的變數是唯讀的。這些在編譯期間完成,編譯器可能使用常數直接替換掉對此變數的引用。初探編譯器static const之實現原理 到商店裡買200的商品返還100優惠券 可以在本商店代替現金 請問實際...