siki學院的習題及答案
int hp;
float x;
float y;
float z;
float speed;
string str1 = console.readline();
int num1 = convert.toint32(str1);
string str2 = console.readline();
int num2 = convert.toint32(str2);
int temp = num1;
num1 = num2;
num2 = temp;
console.writeline(num1+」:「+num2);
console.readkey();
string str1 = console.readline();
int num1 = convert.toint32(str1);
string str2 = console.readline();
int num2 = convert.toint32(str2);
string str3 = console.readline();
int num3 = convert.toint32(str3);
string str4 = console.readline();
int num4 = convert.toint32(str4);
int res = num1 * num2 * num3 * num4;
console.writeline(res);
console.readkey();
string numstr = "234";
int num =234;
int ge = num%10;
int shi =((num - ge)/10)%10;
int bai =num /100;
console.writeline(ge+」「+shi+」」+bai);
console.readkey();
console.writeline(「請輸入上底」);
string str1 = console.readline();
double num1 = convert.todouble(str1);
console.writeline(「請輸入下底」);
string str2 = console.readline();
double num2 = convert.todouble(str2);
console.writeline(「請輸入高」);
string str3 = console.readline();
double num3 = convert.todouble(str3);
double res = (num1 + num2) * num3 /2;
console.writeline(res);
console.readkey();
console.writeline(「請輸入圓的半徑」);
string str = console.readline();
double n = conver.todouble(str);
console.writeline(「圓的周長是」 + (2 * n * 3.14));
console.writeline(「圓的面積是」 + (n * n * 3.14));
console.readkey();
int num1 = convert.toint32(console.readline());
int num2 = convert.toint32(console.readline());
int num3 = convert.toint32(console.readline());
int num4 = convert.toint32(console.readline());
int max,min;
if(num1 > num2)
else
if(num3 > max)
if(num4 > max)
if(num1 < num2)
else
if(num3 < min)
if(num4 < min)
console.writeline(「最大值是:」 + max + 「最小值是:」 + min);
console.readkey();
console.writeline(「please enter first number」);
int num1 = convert.toint32(console.readline());
console.writeline(「please enter second number」);
int num2 = convert.toint32(console.readline());
console.writeline(「請輸入0-3之間的數字」);
int operation = convert.toint32(console.readline());
int res = 0;
switch(operation)
console.writeline(「the result is:」 + res);
console.readkey();
int count = 0;
int sum = 0;
for(int i =1; i <= 1000; i++)}}
console.readkey();
4,編寫乙個控制台程式,分別輸出1~100之間的平方、平方根。
for(int i =1; i <= 100; i++)
console.readkey();
int sum = 0;
for(int i = 1; i <= 100; i++)
}console.writeline(sum);
console.readkey();
for(int i = 2; i < 1001; i++)
}if(iszhishu)
}console.readkey();
for(int i = 1; i < 10; i++)
console.writeline();
}console.readkey();
int num1 = 0, num2 = 0, num3 = 0, num4 = 0, num5 = 0, num6 = 0;
random random = new random();//建立乙個可以生成隨機數的物件
for(int i = 0; i < 100; i++)
}console.writeline(num1);
console.writeline(num2);
console.writeline(num3);
console.writeline(num4);
console.writeline(num5);
console.writeline(num6);
console.readkey();
for(int i = 1; i < 6; i++)
console.readkey();
int index = 1;
while(index < 6)
console.readkey();
int index = 1;
dowhile(index < 6);
console.readkey();
while(true)
else
}if(isaiupperchar == false)
else
console.readkey();
while(true)
console.writeline();
}else if(num < 0)
}
for(int i = 1; i < 1001; i++)
}if(sum == i)
}
C 初級練習題(2)
1.猴子每天吃總數一半多乙個桃子,第n天只剩下乙個桃子。使用者輸入天數n,開始時桃子的總數 2.回文串,乙個字串正讀反讀都一樣。判斷輸入的乙個字串是否是 回文 答案 1.int n 0 console.writeline enter n n convert.toint32 console.readl...
C 指標練習題
1.耶穌有13個門徒,其中有乙個就是出賣耶穌的叛徒,請用排除法找出這位叛徒 13人圍坐一圈,從第乙個開始報號 1,2,3,1,2,3 凡是報到 3 就退出圈子,最後留在圈內的人就是出賣耶穌的叛徒,請找出它原來的序號 使用迴圈鍊錶實現要求 lzy 2011 8 1 include include us...
練習題c (一)
1.計算字串最後乙個單詞的長度,單詞以空格隔開。include include using namespace std int main 2.計算最少出列多少位同學,使得剩下的同學排成合唱隊形 說明 n位同學站成一排,老師要請其中的 n k 位同學出列,使得剩下的k位同學排成合唱隊形。合唱隊形是指這...