2016-06-21 401 views
-2

此錯誤即將出現在哪裏!請幫助!錯誤即將到來,需要輸入結束時的聲明或聲明!在這種情況下應該做什麼?請幫忙!錯誤:預期聲明或輸入結尾處的聲明

#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"); 
    } 
} 
+5

格式化並縮進這個混亂,你會看到。 – Olaf

+0

通常情況下,當代碼中的某處出現'}'錯誤時,女巫就是你的情況。 – chema989

回答

1

沒有}支架關閉main()功能。

0

的一些問題,我可以當場出包括:

  1. 沒有結束}main()

  2. 無限while循環:

    while (1) { 
    // ominous loop with no exit 
    // Be ready to cut the hard line. 
    } 
    
  3. 無縮進&
  4. 未使用的頭jatin.h