quick sort
網頁
▼
2009年12月24日 星期四
2009年11月30日 星期一
2009年11月23日 星期一
2009年11月19日 星期四
請完成該程式!
請完成該程式!
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
using namespace std;
struct students{
double scores[50];
double average;
double stdev;
double Me, Q1, Q3;
};
void sort(double scores[], int len);
double computeAverage(struct students X);
......
2009年11月12日 星期四
2009年11月11日 星期三
2009年10月22日 星期四
2009年10月8日 星期四
2009年10月1日 星期四
2009年9月24日 星期四
2009年9月21日 星期一
2009年9月10日 星期四
2009年6月9日 星期二
fopen
修改下列C程式,將你上學期的各科成績出到excel檔!
#include <stdio.h>
#include <stdlib.h>
int main()
{
char s[8][30]={
"CS0160資訊安全實習,丙",
"CS0160資訊安全實習,甲",
"GE0105A勞作教育,丙",
"IM0007程式設計,丙",
"IM0068統計學[二],甲",
"IM0164資訊安全實習,丙",
"OHA001導師,丙",
"OHTA003在校輔導時間,乙"
};
FILE* fp=fopen("score.xls","w");
for (int i=0; i<8; i++)
fprintf(fp,"%d\t%s\n",i,s[i]);
fclose(fp);
system("Pause");
return 0;
}
2009年6月2日 星期二
2009年5月26日 星期二
2009年5月19日 星期二
2009年5月18日 星期一
2009年5月5日 星期二
2009年5月4日 星期一
2009年4月27日 星期一
RSA的可回復式數位簽章
以下RSA的數位簽章,是採Recover Sign的方式,
已存在"A RSA private key object"的金鑰簽署,機制為RSA_PKCS
BA270F891273A717366EEBDC02A362B4A5EFAB0DB37E4A0E6
29DA548F59385DC2523FFE52D63D6C6374525F0DFBB26BDFA
BB15ED04A85EE90AE503D2A6890F66
請還原簽署文件。
已存在"A RSA private key object"的金鑰簽署,機制為RSA_PKCS
BA270F891273A717366EEBDC02A362B4A5EFAB0DB37E4A0E6
29DA548F59385DC2523FFE52D63D6C6374525F0DFBB26BDFA
BB15ED04A85EE90AE503D2A6890F66
請還原簽署文件。
2009年4月13日 星期一
程式設計練習題
1 使用C/C++程式中迴圈(for, while 或者do/while)計算算式,並含完整程式碼, 流程圖!
S = 1 × 2 × 3 + 2 × 3 × 4 + · · · + 100 × 101 × 102
2 請問下列程式片段之輸出!要加上什麼才能成為完整程式碼?
int x=5,y=3,z,w;
x-=2;
cout<<++x<<endl;
z=y++;
cout<<z<<endl;
cout<<y<<endl;
w=--z;
cout<<z<<endl;
cout<<(w<<3)<<endl;
for(x=10;x>=6;x--){
if (x%2==1)
continue;
cout<<x<<endl;
if (x==7) break;
};
cout<<x<<endl;
3 下列程式片段之輸出!並補上標頭檔
int main(){
int j=2;
int i=0xc;
double E=2.7182818284590;
printf("[%-5d]\n",i);
printf("[%3x]\n",i);
printf("[%3d]\n",j);
printf("[%d]\n",sizeof(E));
printf("[%-16.10f]\n",E);
printf("[%f]\n",E);
system("PAUSE");
return 0;
}
4 下列程式片段之輸出!並用if-else改寫!流程圖為何?
int i;
for (i=0;i<7;i++)
{
switch(i){
case 0:
printf("i=%d\n",i);break;
case 1:
printf("i=%d\n",i);break;
case 2:
printf("i=%d\n",i);break;
default:
printf("i>2\n");break;
};
};
printf("i=%d\n", ++i);
5 下列C/C++程式之輸出!並
改寫主程式使其輸出為:
@@@@@
@@@
  @
#include <iostream>
using namespace std;
void prCh(char ch, int rows);
int main(){
for(int i=1;i<5;i++){
prCh('A',i-1);
prCh('B',i);
cout<<endl;
}
cin.get();
return 0;
}
void prCh(char ch, int rows){
for (int i=rows;i>=1;i--){
cout<<ch;
}
}
6 已知20以下的質數,也知道測試400以下是否為質數的函數,請寫出C/C++程式列出
所有20<=x<=400 AND x%4==1的質數
int Prime[]={2,3,5,7,11,13,17,19,23};
bool isPrimebelow400(int n)
{
int n_sqrt=(int)sqrt(n);
for (int i=0; Prime[i]<=n_sqrt; i++)
{
if (n%Prime[i]==0 && n>Prime[i])
return 0;
}
return 1;
}
S = 1 × 2 × 3 + 2 × 3 × 4 + · · · + 100 × 101 × 102
2 請問下列程式片段之輸出!要加上什麼才能成為完整程式碼?
int x=5,y=3,z,w;
x-=2;
cout<<++x<<endl;
z=y++;
cout<<z<<endl;
cout<<y<<endl;
w=--z;
cout<<z<<endl;
cout<<(w<<3)<<endl;
for(x=10;x>=6;x--){
if (x%2==1)
continue;
cout<<x<<endl;
if (x==7) break;
};
cout<<x<<endl;
3 下列程式片段之輸出!並補上標頭檔
int main(){
int j=2;
int i=0xc;
double E=2.7182818284590;
printf("[%-5d]\n",i);
printf("[%3x]\n",i);
printf("[%3d]\n",j);
printf("[%d]\n",sizeof(E));
printf("[%-16.10f]\n",E);
printf("[%f]\n",E);
system("PAUSE");
return 0;
}
4 下列程式片段之輸出!並用if-else改寫!流程圖為何?
int i;
for (i=0;i<7;i++)
{
switch(i){
case 0:
printf("i=%d\n",i);break;
case 1:
printf("i=%d\n",i);break;
case 2:
printf("i=%d\n",i);break;
default:
printf("i>2\n");break;
};
};
printf("i=%d\n", ++i);
5 下列C/C++程式之輸出!並
改寫主程式使其輸出為:
@@@@@
@@@
  @
#include <iostream>
using namespace std;
void prCh(char ch, int rows);
int main(){
for(int i=1;i<5;i++){
prCh('A',i-1);
prCh('B',i);
cout<<endl;
}
cin.get();
return 0;
}
void prCh(char ch, int rows){
for (int i=rows;i>=1;i--){
cout<<ch;
}
}
6 已知20以下的質數,也知道測試400以下是否為質數的函數,請寫出C/C++程式列出
所有20<=x<=400 AND x%4==1的質數
int Prime[]={2,3,5,7,11,13,17,19,23};
bool isPrimebelow400(int n)
{
int n_sqrt=(int)sqrt(n);
for (int i=0; Prime[i]<=n_sqrt; i++)
{
if (n%Prime[i]==0 && n>Prime[i])
return 0;
}
return 1;
}
2009年4月8日 星期三
2009年4月7日 星期二
字串陣列
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
char s[8][30]={
"CS0160資訊安全實習,丙",
"CS0160資訊安全實習,甲",
"GE0105A勞作教育,丙",
"IM0007程式設計,丙",
"IM0068統計學[二],甲",
"IM0164資訊安全實習,丙",
"OHA001導師,丙",
"OHTA003在校輔導時間,乙"
};
for (int i=0; i<8; i++)
cout<<i<<"\t"<<s[i]<<endl;
system("Pause");
return 0;
}
2009年4月6日 星期一
2009年3月31日 星期二
2009年3月30日 星期一
2009年3月24日 星期二
C 的continue & break
C 的continue & break
[影片]介紹C++程式for迴圈中加上continue與break的差異之簡例
Java迴圈中的的continue & break
[影片]介紹C++程式for迴圈中加上continue與break的差異之簡例
Java迴圈中的的continue & break
2009年3月18日 星期三
2009年3月10日 星期二
12 Random Number Integers from [1, 120]
<script type="text/javascript">
function rand(){
var max=120;
var min=1;
for(var i=1;i<=12;i++){
n = Math.floor(Math.random() * (max - min + 1)) + min;
document.write(n + "<br />");
}
}
</script>
<form>
<input type=button value="按鈕字串" onclick="rand( )">
</form>