오류 좀 해결해주세요.
알찬마루
오류 좀 해결해주세요.구문 오류는 없는데 작동을 안해요. 오류 좀 찾아주세요.질문 내용 :
소스 올리겠습니다.
// 삼각형 넓이 구하기.c : defines the entry point for the console application.
#include stdafx.h
#include stdio.h
#include math.h
void main(){
int type;
float n = 3;
float a;
float b;
float c;
float a;
float b;
float c;
float s;
float result;
printf(정삼각형 : 1, 그 외의 삼각형 : 2\n);
scanf(%d,type);
if(type == 1){
printf(한 변의 길이를 적으세요 : \n);
scanf(%d,a);
result = sqrt(n) * 4 * a * a;
printf(지금 계산 중입니다......);
printf(result);
}else if(type == 2){
printf(길이를 알고 있는 변의 갯수를 적으세요 : \n);
scanf(%d,type);
if(type == 0){
printf(errorcode1 : 넓이를 구할 수 없습니다.);
}else if(type == 1){
printf(크기를 알고 있는 각의 갯수를 적으세요 :\n);
scanf(%d,type);
if(type == 1) {
printf(errorcode1 : 넓이를 구할 수 없습니다.);
}else if(type == 2){
printf(두 각이 길이를 알고 있는 변의 양쪽 각입니까?(o:1/x:2) :\n);
scanf(%d,type);
if(type == 1){
printf(한 변의 크기를 적으세요 :\n);
scanf(%d,a);
printf(한 각의 크기를 적으세요 :\n);
scanf(%d,a);
printf(나머지 한 각의 크기를 적으세요 :\n);
scanf(%d,b);
result = a * sin(a) * sin(b) / sin(180 - a - b) / 2;
printf(지금 계산 중입니다......);
printf(result);
}else if(type == 2){
printf(한 변의 크기를 적으세요 :\n);
scanf(%d,a);
printf(한 변의 한 쪽 각의 크기를 적으세요 :\n);
scanf(%d,a);
printf(나머지 한 각의 크기를 적으세요 :\n);
scanf(%d,b);
result = pow(a,2) * sin(a) * sin(b) / sin(180 - a - b) / 2;
printf(지금 계산 중입니다......);
printf(result);
}else{
printf(errorcode2 : 1이나 2만 입력해주세요.);
}
}else if(type==3){
printf(errorcode2 : 1이나 2만 입력해주세요.);
}else{
printf(errorcode3 : 0 초과의 유리수만 입력해주세요.);
}
}else if(type == 2){
printf(두 변의 사잇각의 크기를 알고 있습니까?(o:1/x:2) :\n);
scanf(%d,type);
if(type == 1){
printf(한 변의 길이를 적으세요 :\n);
scanf(%d,a);
printf(나머지 변의 길이를 적으세요 :\n);
scanf(%d,b);
printf(한 각의 크기를 적으세요 :\n);
scanf(%d,a);
result = a * b * sin(a) / 2;
printf(지금 계산 중입니다......);
printf(result);
}else{
printf(errorcode1 : 넓이를 구할 수 없습니다.);
}
}else if(type==3){
printf(어떤 공식으로 구하시겠습니까?(헤론의 공식 : 1/코사인 법칙 : 2) :\n);
scanf(%d,type);
if(type==1){
printf(한 변의 길이를 적으세요 :\n);
scanf(%d,a);
printf(다른 한 변의 길이를 적으세요 :\n);
scanf(%d,b);
printf(나머지 한 변의 길이를 적으세요 :\n);
scanf(%d,c);
s = (a + b + c) / 2;
result = sqrt(s * (s - a) * (s - b) * (s - c));
printf(지금 계산 중입니다......);
printf(result);
}else if(type == 2){
printf(한 변의 길이를 적으세요 :\n);
scanf(%d,a);
printf(다른 한 변의 길이를 적으세요 :\n);
scanf(%d,b);
printf(나머지 한 변의 길이를 적으세요 :\n);
scanf(%d,c);
//이 자리에 arcsin을 쓸 것입니다.
}else{
printf(errorcode3 : 0 초과의 유리수만 입력해주세요.);
&n);
}
}else{
printf(errorcode3 : 0 초과의 유리수만 입력해주세요.);
}
}else{
printf(errorcode2 : 1이나 2만 입력해주세요.);
}
}
-
김슬픔
말씀드렸듯이 구문 오류는 없는데 다만 작동만 안해요;;;;;;
-
가지등
오류부분 복사해서 좀 올려주시면 편할텐데..