gpt4 book ai didi

c - 错误: expected declaration or statement at end of input

转载 作者:行者123 更新时间:2023-11-30 20:22:56 25 4
gpt4 key购买 nike

这个错误不知从何而来!!请帮忙!出现错误,需要输入末尾的声明或语句!这种情况应该怎么办??请帮忙!

#include<stdio.h>
#include "jatin.h"

int main() {
int t1, t2;
char sc1, sc2;
while (1) {
printf("Enter a temperature and a scale\n");
scanf("%d %c", &t1, &sc1);
convert_temp(t1, sc1, &t2, &sc2);
printf("%d %c = %d %c\n", t1, sc1, t2, sc2);
}
void convert_temp(int t1, char sc1, int *t2, char *sc2)
{
if (sc1 == 'F' || sc1 == 'f')
{
*t2 = (t1-32)/1.8;

}
else if (sc1 == 'C' || sc1 == 'c')
{

*t2 = (1.8*t1)+32;

}
else
{
printf("Enter valid temperature");
}
}

最佳答案

没有 } 括号关闭 main() 函数。

关于c - 错误: expected declaration or statement at end of input,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37950651/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com