C 中有多少基本數(shù)據(jù)類型?為什么我的C 代碼數(shù)據(jù)讀不出來(lái)?還有夏爾。C 定義了另外兩個(gè)基本數(shù)據(jù)類型:bool和wchar _ T,有些基本數(shù)據(jù)類型可以帶符號(hào),一個(gè)c 程序輸出數(shù)據(jù) type的長(zhǎng)度是錯(cuò)誤的,從這個(gè)例子我們可以知道:charcintddoublea肖特;shortf} y;coutc 中如何保存和刪除數(shù)據(jù)。
# include # includeusingnamespacestd;inti prime(intn){ inti;對(duì)于(I2;i * i1}intmain(){inti,n0;對(duì)于(I2;i>ws,str);Cin>>ws的意思是首先跳過(guò)輸入緩沖區(qū)開(kāi)頭的空白字符,然后讀入str。這種方法適用于中間有多個(gè)空格的情況。
2、一個(gè)C 程序輸出 數(shù)據(jù)類型長(zhǎng)度以上大護(hù)理師的說(shuō)法不正確。從這個(gè)例子可以知道:# include # include voidman(){ struct example { charb;charcintddoublea肖特;shortf} y;coutlen0} int getlength(){ return this > len;} intget elem(inti){ if(ithis > len)return 0;elsereturnthis > data[i1];} int locate(elem typex){ inti 0;while(this>data[i]!x)i ;if(i>this>len)返回0;elsereturni 1;}intInsElem(Elemtypex。