여기에 C 언어 noobie 비트가 있습니다. 어쨌든, 나는이 프로젝트를 잠시 동안 작업 해왔다. Visual Studio 2010에서 컴파일 할 때 오류가 발생했다.온도 프로젝트를 계산하면 오류가 발생합니다.
수레를 사용할 때 데이터 손실이 발생할 수 있습니다 (전체 프로젝트는 수레를 기반으로합니다).
또한 오류가 발생합니다.
1> ------ 빌드 시작 : 프로젝트 : 프로젝트 구성 : 디버그는 Win32 ------ 1> project.c 1> C : \ 사용자 \ suliman 문서는 시각적 \ \ 스튜디오 2010 \ projects \ project \ project \ project.c (44) : 경고 C4996 : 'scanf':이 함수 또는 변수가 안전하지 않을 수 있습니다. 대신에 scanf_s를 사용해보십시오. 지원 중단을 사용하지 않으려면 _CRT_SECURE_NO_WARNINGS를 사용하십시오. 자세한 내용은 온라인 도움말을 참조하십시오. 1> c : \ users \ suliman \ documents \ visual studio 2010 \ c : \ program files (x86) \ microsoft visual 스튜디오 10.0 \ vc \ include \ stdio.h (304) : 'scanf'의 선언 참조 1> projects \ project \ project \ project.c (55) : 경고 C4013 : '시스템'이 정의되지 않았습니다. extern returns int 1> c : \ users \ suliman \ documents \ visual 스튜디오 2010 \ projects \ project \ project \ project.c (29) : 경고 C4101 : 'y': 참조되지 않은 지역 변수 1> c : \ users \ suliman \ documents \ visual studio 2010 \ projects \ project \ project \ project.c (77) : 경고 C4244 : '=': 'int'에서 'float'로 변환, 데이터 손실 가능성 있음 1> c : \ users \\ suliman \ documents \ visual studio 2010 \ projects \ project \ project \ project.c (78) : 경고 C4244 : '=': 'int'에서 'float'로 변환, 데이터 손실 가능성 있음 1> c : \ users \ suliman \ documents \ visual studio 2010 \ projects \ project \ project \ project.c (79) : 경고 C4244 : '=': 'int'에서 'float'로 변환, 데이터 손실 가능성 있음 1> c : \ users \ suliman \ documents \ visual studio 2010 \ projects \ project \ project \ project.c (80) : 경고 C4244 : '=': 'int'에서 'float'로 변환, 데이터 손실 가능성 있음 1> C : \ 사용자 \ suliman 비주얼 스튜디오 \ 문서 \ 2010 \ 프로젝트 \ 프로젝트 \ 프로젝트 \의 project.c (81) : 어
그리고 이것은 복용시 내 코드
#include <stdio.h>
void table();
float inspect();
float calculation(float x1, float x2, float x3);
float SLOPE();
//time, **t is for time**
int t1=0;
int t2 = 1;
int t3 = 2;
int t4 = 3;
int t5 = 4;
int t6 = 5;
//Tempreture **h is for heat**
int h1=20;
int h2=36;
int h3=61;
int h4=68;
int h5=77;
int h6=110;
int n=6;
int main()
{
float m;
float b;
float y,x;
float res2;
float res1;
float result;
table();
m=SLOPE();
b=inspect();
res1=calculation(b,m,1.5);
printf("The temperture int TIME 1.5=%f\n",result);
res2=calculation(b,m,4.5);
printf("The temperture int time at 4.5 = %f\n", result);
printf("Please enter the time values you require");
scanf("%f",&x);
if (x>0)
{
result=calculation(b,m,x);
printf("The temperture value is: %f",result);
}
else
printf("**ERROR**");
system("pause");
return 0;
}
void table()
{
printf("Time Tempreture\n");
printf("%d %d\n",t1,h1);
printf("%d %d\n",t2,h2);
printf("%d %d\n",t3,h3);
printf("%d %d\n",t4,h4);
printf("%d %d\n",t5,h5);
printf("%d %d\n",t6,h6);
}
float inspect()
{
float result;
float e1,e2,e3,e4;
e1=t1+t2+t3+t4+t5+t6;
e2=t1*h1+t2*h2+t3*h3+t4*h4+t5*h5+t6*h6;
e3=h1+h2+h3+h4+h5+h6;
e4=t1*t1+t2*t2+t3*t3+t4*t4+t5*t5+t6*t6;
result=(e1*e3-n*e2)(e1*e1-n*e4);
return result;
}
float calculation(float x1,float x2, float x3)
{
float y;
y=x2*x3+x1;
return y;
}
결과 = (e1 * e3-n * e2) (e1 * e1-n * e4)에 컴파일 오류가 있습니다. 검사 기능 라인. –
float 변환 경고에 대해서는 http://stackoverflow.com/questions/7775129/int-to-float-conversion-produces-a-warning을 참조하십시오. –
그러면 오류를 수정하는 방법은 무엇입니까? –