資源簡介
數據結構教程第三版上機實驗題源程序
代碼片段和文件信息
//文件名:exp1-1.cpp
#include?
#include?
bool?prime(int?n) //判斷正整數n是否為素數
{
int?i;
for?(i=2;i<=(int)sqrt(n);i++)
if?(n%i==0)?
return?false; //若n不是素數則退出并返回false
return?true;
}
void?main()
{
int?nij=0; //j用于累計素數個數
printf(“n:“);
scanf(“%d“&n);
printf(“小于等于%d的素數:\n“n);
if?(n>2)
{ printf(“%4d“2);
j++;
}
for?(i=3;i<=n;i+=2)
if?(prime(i))
{ printf(“%4d“i);
if?(j!=0?&&?++j%10==0) //每行最多顯示10個素數
printf(“\n“);
}
printf(“\n“);
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????560??2010-11-22?08:03??數據結構教程上機指導\數據結構上機指導-源程序\實驗題1\exp1-1.cpp
?????文件????????295??2010-11-22?08:04??數據結構教程上機指導\數據結構上機指導-源程序\實驗題1\exp1-2.cpp
?????文件????????471??2010-11-22?08:22??數據結構教程上機指導\數據結構上機指導-源程序\實驗題1\exp1-3.cpp
?????文件???????1148??2010-11-25?07:57??數據結構教程上機指導\數據結構上機指導-源程序\實驗題10\exp10-1.cpp
?????文件???????2250??2010-11-25?08:55??數據結構教程上機指導\數據結構上機指導-源程序\實驗題10\exp10-10.cpp
?????文件???????1141??2010-11-25?08:00??數據結構教程上機指導\數據結構上機指導-源程序\實驗題10\exp10-2.cpp
?????文件???????1095??2010-11-25?08:06??數據結構教程上機指導\數據結構上機指導-源程序\實驗題10\exp10-3.cpp
?????文件???????1473??2010-11-25?08:20??數據結構教程上機指導\數據結構上機指導-源程序\實驗題10\exp10-4.cpp
?????文件???????1175??2010-11-25?08:22??數據結構教程上機指導\數據結構上機指導-源程序\實驗題10\exp10-5.cpp
?????文件???????2271??2010-11-25?08:35??數據結構教程上機指導\數據結構上機指導-源程序\實驗題10\exp10-6.cpp
?????文件???????2092??2010-11-25?08:42??數據結構教程上機指導\數據結構上機指導-源程序\實驗題10\exp10-7.cpp
?????文件???????2076??2010-11-25?08:44??數據結構教程上機指導\數據結構上機指導-源程序\實驗題10\exp10-8.cpp
?????文件???????1514??2010-11-25?08:49??數據結構教程上機指導\數據結構上機指導-源程序\實驗題10\exp10-9.cpp
?????文件???????3988??2010-11-26?09:33??數據結構教程上機指導\數據結構上機指導-源程序\實驗題11\exp11-1.cpp
?????文件???????2896??2010-11-26?09:47??數據結構教程上機指導\數據結構上機指導-源程序\實驗題11\exp11-2.cpp
?????文件???????3946??2010-11-28?10:59??數據結構教程上機指導\數據結構上機指導-源程序\實驗題12\exp12-1.cpp
?????文件???????4659??2010-11-28?14:28??數據結構教程上機指導\數據結構上機指導-源程序\實驗題12\exp12-2.cpp
?????文件???????4326??2010-11-28?17:31??數據結構教程上機指導\數據結構上機指導-源程序\實驗題13\excise1.cpp
?????文件??????10729??2010-11-29?07:54??數據結構教程上機指導\數據結構上機指導-源程序\實驗題13\excise2.cpp
?????文件???????7024??2010-11-29?09:14??數據結構教程上機指導\數據結構上機指導-源程序\實驗題13\excise3.cpp
?????文件???????3303??2010-11-29?09:37??數據結構教程上機指導\數據結構上機指導-源程序\實驗題13\excise4.cpp
?????文件???????1829??2010-11-29?14:38??數據結構教程上機指導\數據結構上機指導-源程序\實驗題13\excise5.cpp
?????文件???????8516??2010-11-29?15:02??數據結構教程上機指導\數據結構上機指導-源程序\實驗題13\excise6.cpp
?????文件???????1033??2010-11-24?14:50??數據結構教程上機指導\數據結構上機指導-源程序\實驗題13\graph.h
?????文件???????1898??2010-11-22?08:31??數據結構教程上機指導\數據結構上機指導-源程序\實驗題2\algo2-1.cpp
?????文件???????2584??2010-11-22?08:47??數據結構教程上機指導\數據結構上機指導-源程序\實驗題2\algo2-2.cpp
?????文件???????2840??2010-11-22?09:01??數據結構教程上機指導\數據結構上機指導-源程序\實驗題2\algo2-3.cpp
?????文件???????2789??2010-11-22?10:08??數據結構教程上機指導\數據結構上機指導-源程序\實驗題2\algo2-4.cpp
?????文件???????3305??2010-11-22?10:22??數據結構教程上機指導\數據結構上機指導-源程序\實驗題2\algo2-5.cpp
?????文件???????1408??2010-11-22?08:34??數據結構教程上機指導\數據結構上機指導-源程序\實驗題2\exp2-1.cpp
............此處省略93個文件信息
- 上一篇:C語言JSON解析(Exjson)
- 下一篇:c++ 漢諾塔
評論
共有 條評論