멀티파일 하는방법을 모르겠어요
안녕하세요. 소스파일 하나를 프로젝트로 멀티파일하라고 하는데 제가 비전공자로
석사를 하게되서 구글링하며 겨우하고 있는데 멀티파일은 개념부터가 잘 안생기더라고요.
밑에 파일 어떻게는 컴파일링 하려고했는데 3일째 못하고 질문드립니다. 제발 도와주세요~~~ㅜㅜ 부탁드려요,
소스 밑에 저장했어요
헤더파일
#include
#include
#include
#include
#include "functions.c"
extern long int total; /*global, data*/
extern int countservice;
extern void sendParcel(total,countservice);
extern void sendMail(total,countservice);
extern void sellStamps(total,countservice);
extern void exchangeMoney(total,countservice);
메인파일
#include "header.h"
int main()
{
int menu; /*automatic, stack*/
int restart=1;
printf("\n\t\t****************************************");
printf("\n\t\t------POST OFFICE MANAGEMENT SYSTEM-----");
printf("\n\t\t****************************************");
Sleep(2000);
do
{
printf("\n 1 : Courier service");
printf("\n 2 : Postal service");
printf("\n 3 : Stamp sales");
printf("\n 4 : Exchange service");
printf("\n 5 : Exit\n");
scanf("%d",&menu); /*Input number service you want*/
system("cls");
while(menu >= 6 || menu <= 0)
{ printf("\n 1 : Courier service");
printf("\n 2 : Postal service");
printf("\n 3 : Stamp sales");
printf("\n 4 : Exchange service");
printf("\n 5 : Exit\n");
printf("Please select again");
scanf("%d",&menu);
MessageBox(0,"Invalid Number!\nEnter Again","Error!",0);
}
switch(menu)
{
case 1 :
printf("\n\t************************************");
printf("\n\tWe will guide you by courier service.");
printf("\n\t************************************");
Sleep(2000);
system("cls");
countservice++;
sendParcel(total,countservice);
break;
case 2 :
printf("\n\t************************************");
printf("\n\tI will help you with postal services.");
printf("\n\t************************************");
Sleep(2000);
system("cls");
countservice++;
sendMail(total,countservice);
break;
case 3 :
printf("\n\t***********************");
printf("\n\tWe sell various stamps.");
printf("\n\t***********************");
Sleep(2000);
system("cls");
countservice++;
sellStamps(total,countservice);
break;
case 4 :
printf("\n\t*********************************************");
printf("\n\tWe will help you with your exchange business.");
printf("\n\t*********************************************");
Sleep(2000);
system("cls");
countservice++;
exchangeMoney(total,countservice);
break;
case 5 :
printf("\n\t**********");
printf("\n\tGood bye~~.");
printf("\n\t**********");
getch();
exit(0);
}
system("cls");
printf("\n\t*******************************");
printf("\n\tCan I help you further?(Y=1,N=0)");
printf("\n\t********************************\n");
scanf("%d",&restart);
}while(restart==1);
printf("\n\t********************************");
printf("\n\tThank you for using our service.");
printf("\n\t********************************");
return 0;
}
function 파일
void sendParcel(total,countservice)
{
int overseas; /*local, stack*/
int fee;
int weight;
int result;
printf("\n\n\nAre you sending it overseas?(Y=1,N=0)");
scanf("%d",&overseas);
while(overseas >= 2 || overseas < 0)
{
printf("Please select again");
scanf("%d",&overseas);
}
if(overseas==1)
{
int continent;
printf("\nWhich continent do you send to?");
printf("\n1.ASIA\n2.AMERICA\n3.EUROPE\n4.AFRICA\n5.ACEANIA\n");
scanf("%d",&continent);
switch(continent)
{
case 1 : printf("\n\t*******************************");
printf("\n\tThe rate is 1000 rupees per kg.");
printf("\n\t*******************************");
fee = 1000;
break;
case 2 : printf("\n\t*******************************");
printf("\n\tThe rate is 1200 rupees per kg.");
printf("\n\t*******************************");
fee = 1200;
break;
case 3 : printf("\n\t*******************************");
printf("\n\tThe rate is 1800 rupees per kg.");
printf("\n\t*******************************");
fee = 1800;
break;
case 4 : printf("\n\t*******************************");
printf("\n\tThe rate is 1500 rupees per kg.");
printf("\n\t*******************************");
fee = 1500;
break;
case 5 : printf("\n\t*******************************");
printf("\n\tThe rate is 1300 rupees per kg.");
printf("\n\t*******************************");
fee = 1300;
break;
}
}
else
{
printf("\n\t***************************************************");
printf("\n\tDomestic is 400 rupees per kg regardless of region.");
printf("\n\t***************************************************");
fee = 400;
}
Sleep(2000);
system("cls");
printf("\nWhat is the weight of your parcel?\n");
scanf("%d",&weight);
result = weight*fee;
total = total+result;
printf("\n\t\t***********************");
printf("\n\t\tThe courier fee is Rs %d.",result);
printf("\n\t\t***********************");
printf("\n\n\t\t******************************");
printf("\n\t\tYou have used all %d services.",countservice);
printf("\n\t\t******************************");
printf("\n\n\t\t************************");
printf("\n\t\tThe Total cost is Rs %d.",total);
printf("\n\t\t************************");
getch();
}
void sendMail(total,countservice)
{
int overseas; /*automatic, stack*/
int fee;
int result;
int letter;
printf("\n\n\nAre you sending it overseas?(Y=1,N=0)");
scanf("%d",&overseas);
while(overseas >= 2 || overseas < 0)
{
printf("Please select again");
scanf("%d",&overseas);
}
switch(overseas)
{
case 0 : printf("\n\t****************************");
printf("\n\tDomestic mail is 300 rupees.");
printf("\n\t****************************");
fee = 50;
break;
case 1 : printf("\n\t*********************************");
printf("\n\tInternational mail is 300 rupees.");
printf("\n\t*********************************");
fee = 300;
break;
}
Sleep(2000);
system("cls");
printf("\nHow many letters?\n");
scanf("%d",&letter);
result = letter*fee;
printf("\n\t\t***********************");
printf("\n\t\tThe letter fee is Rs %d.",result);
printf("\n\t\t***********************");
total = total+result;
printf("\n\n\t\t******************************");
printf("\n\t\tYou have used all %d services.",countservice);
printf("\n\t\t******************************");
printf("\n\n\t\t************************");
printf("\n\t\tThe Total cost is Rs %d.",total);
printf("\n\t\t************************");
getch();
}
void sellStamps(total,countservice)
{
int result;
total = total+result;
printf("\n\n\t\t******************************");
printf("\n\t\tYou have used all %d services.",countservice);
printf("\n\t\t******************************");
printf("\n\n\t\t************************");
printf("\n\t\tThe Total cost is Rs %d.",total);
printf("\n\t\t************************");
getch();
}
void exchangeMoney(total,countservice)
{
int country;
float exchangeratio;
char unit1;
char unit2;
char unit3;
int foreignmoney;
int result;
printf("Which country money do you want to exchange?(1.Korea 2.USA 3.EU 4.China)\n");
scanf("%d",&country);
while(country>=5 || country<=0)
{
printf("Please select again");
scanf("%d",&country);
}
switch(country)
{
case 1 : printf("\n\t*******************************************************");
printf("\n\tThe ratio of Korean wons to Indian rupees is 0.061 to 1.");
printf("\n\t*******************************************************");
exchangeratio = 0.061;
unit1 = 'K';
unit2 = 'R';
unit3 = 'W';
break;
case 2 : printf("\n\t******************************************************");
printf("\n\tThe ratio of US dollars to Indian rupees is 68.7 to 1.");
printf("\n\t******************************************************");
exchangeratio = 68.7;
unit1 = 'U';
unit2 = 'S';
unit3 = 'D';
break;
case 3 : printf("\n\t******************************************************");
printf("\n\tThe ratio of EU euros to Indian rupees is 79.9 to 1.");
printf("\n\t******************************************************");
exchangeratio = 79.9;
unit1 = 'E';
unit2 = 'U';
unit3 = 'R';
break;
case 4 : printf("\n\t******************************************************");
printf("\n\tThe ratio of Chinese Yuans to Indian rupees is 10.32 to 1.");
printf("\n\t******************************************************");
exchangeratio = 10.32;
unit1 = 'C';
unit2 = 'N';
unit3 = 'Y';
break;
}
printf("\nExchange ratio is %.3f\n",exchangeratio);
printf("\nHow much %c%c%c do you need?\n",unit1,unit2,unit3);
scanf("%d",&foreignmoney);
result = foreignmoney*exchangeratio;
printf("%d is required depending on the exchange rate.\n", result);
total = total+result;
printf("\n\n\t\t******************************");
printf("\n\t\tYou have used all %d services.",countservice);
printf("\n\t\t******************************");
printf("\n\n\t\t************************");
printf("\n\t\tThe Total cost is Rs %d.",total);
printf("\n\t\t************************");
getch();
}
첨부 | 파일 크기 |
---|---|
main.zip | 3.1 KB |
멀티파일 하라는 말은 저도 모르겠네요.
kldp에 글 쓸 때 소스 코드 넣으려면
https://kldp.org/node/158191
참고하셔요.
세벌 https://sebuls.blogspot.kr/
댓글 달기