3 回答

TA貢獻1995條經驗 獲得超2個贊
c:\c\567\5556.cpp(1) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
解決此warning的辦法是#include語句后不加分號
#include "mex.h" %注意語句后沒有分號哦~
c:\c\567\5556.cpp(1) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
是在程序庫路徑設置上缺少添加庫,導致程序編譯的時候找不到頭文件,在Tools -> Options -> Projects and Solutions -> VC++ Directories選項Show directories for選擇include files,加入你庫文件的路徑,也可以在你程序中加入programma comment語句,然后把'bios.h'這個文件放在你工程所在的同一個文件夾里面

TA貢獻2080條經驗 獲得超4個贊
#include <stdio.h>
double fact(int n)
{
double ft;
for(ft=1;n>=1;n--)
ft*=n;
return ft;
}
void main()
{
double m1,m2,a;
int t;
printf("Input t:\n");
scanf("%d",&t);
m1=fact(t);
printf("%d!=0",t);
printf("%lf\n",m1);
m2=fact(2+t);
printf("%d!=",2+t);
printf("%lf\n",m2);
getchar();
getchar();
}

TA貢獻1848條經驗 獲得超10個贊
大括號的個數不匹配,說白了就是多了一個大括號。你那_tmain函數被你貼過來的代碼破壞了。把tmain那行刪了再把getchar上面那個大括號刪了
- 3 回答
- 0 關注
- 150 瀏覽
添加回答
舉報