作者executor1107 (計概讓人起笑...)
看板NSYSU-CSE97
標題[作業] [計概] Work9
時間Tue Dec 14 12:29:39 2004
未Debug未完成版XD
Mighty god,please give me some quieter roomate plz...orz
#include<stdio.h>
#include<stdlib.h>
//Mean to trying the block of input
void input(length[0],length[1],length[2])
{
do{
printf("Please enter the number of the first length:\n");
scanf("%d",&length[0]);
if(length[0]<0)
printf("Please enter a positive number.\n");
}while(length[0]<0);
do{
printf("Please enter the number of the second length:\n");
scanf("%d",&length[1]);
if(length[1]<0)
printf("Please enter a positive number.\n");
}while(length[1]<0);
do{
printf("Please enter the number of the third length:\n");
scanf("%d",&length[2]);
if(length[2]<0)
printf("Please enter a positive number.\n");
}while(length[2]<0);
}
//swap the number to the longest>medium>shortest.
void swap(length[0],length[1],length[2])
{
int temp;
for(i=0;i<3;i++){
if(length[i+1]>length[i]){
temp=length[i];
length[i]=length[i+1];
length[i+1]=temp;
}
}
}
//
void input2(division)
{
printf("Input the number which you wish the longest length be divided to:");
scanf("%d",&division);
if(division<0)
printf("Please enter a positive number.\n");
}
void main()
{
FILE *finput,*foutput;
int length[],division;
input(length[0],length[1],length[2])//look into the first function "input"
swap(length[0],length[1],length[2])// look into the second function "swap"
finput=fopen("input.txt","w+");
if(finput != NULL)
for(i=0;i<3;i++)
fprintf(finput,"%d\n",length[i]);
else printf("Error 01:Couldn't open input.txt in writing and reading phase.");
input2(division)//look into the third function "input2"
fclose(finput);
fclose(foutput);
}
--
......ID......
......I am a learning Dancer......
Shake my body through the music...
Dance with the Feel...
This is my ID......
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.117.186.180
1F:推 TheMinyen:你有寫面積那邊嗎? 140.117.199.8 12/14
2F:推 executor1107:沒~<( ̄︶ ̄)/...剛剛被吵的寫不下XD 140.117.186.180 12/14
3F:推 babysitter:你有判斷兩邊和要大於第三邊嗎? 140.117.206.228 12/14
4F:推 executor1107:對吼.我忘了...orz 140.117.186.180 12/14