『壹』 c語言term does not evaluate to a function
1, 定義的變數,要放在輸出的前面,(有些編譯器會報錯,要先定義變數在使用輸出)2.、
你定義的變數名和函數名相同會報錯,把inthnt;換成其他的變數就行了
#include<stdio.h>
inthnt(intx);
intmain()
{
inta;
printf("漢諾塔游戲 ");
scanf("%d",&a);
printf("需要移動%d次",hnt(a));
return0;
}
inthnt(intx)
{
inthnt1;
if(x>1)
hnt1=2*hnt(x-1)+1;
else
hnt1=1;
returnhnt1;
}
『貳』 C語言 出現terms does not evaluate to a function錯誤
#include<stdio.h>
intmain()
{
longn=1,m=1;
for(m=1;m<100000;m++){
for(n=1;n<100000;n++){
if(n*n==(m*(m+1))/2){
printf("n=%d,m=%d ",n,m);
break;
}
}
}
return0;
}
『叄』 c語言term does not evaluate to a function
其實就是提示你,你的返回類型是void但是你卻在程序最後return 了,,,這樣就矛盾了,,,如果你定義了int 但是沒有return,會提示你,**must have return a value ,,,,
再就是了,,,你的程序裡面有很多的錯誤,()錯誤,因該為[]表示下標運算符,再就是了,及時可以返回值,你return m[i]表示返回一個值,而非地址,或者拍好了了的,數組名,,,
再就是了你的冒泡排序存在問題,因該是
我給你修改了,,你看一下,
//#include<string.h> //為什麼要加這么多的頭文件,?好看?不適用,建議你看一下,每個頭文件都包含那些關鍵字或函數
//#include<stdlib.h> //調用malloc時必須,否則會導致錯誤
#include<stdio.h>
//#include<ctype.h>
//#include<conio.h> // getch() 暫定作用,輸入一個數但是不顯示在屏幕上,可以這樣測試 printf("%c",getch());
void proc(char* m,int num)
{
int i,j;
char c;
for(i=0;i<num;i++) //從零開始比較,雖然你定義了一個10元素,但是在下面的實參中是9,為什麼還要-1
{
for(j=i+1;j<num;j++)
if(m[i]>m[j])
{ c=m[j]; // 不要拉上這個{,因為這個三部都屬於if語句
m[j]=m[i];
m[i]=c;
}
}
}
void main()
{
char t[10];
gets(t); //對這里相對了,其職能輸入9個,因為最後那個要作為'\0',
proc(t,9);
printf("\n%s",t);
}
返回情況
#include<stdio.h>
char *proc(char* m,int num) // 返回值為指針類型
{
int i,j;
char c;
for(i=0;i<num;i++)
{
for(j=i+1;j<num;j++)
if(m[i]>m[j])
{ c=m[j];
m[j]=m[i];
m[i]=c;
}
}
return m;// m作為數組名返回,其實是一個指針,
}
void main()
{
char t[10];
gets(t);
printf("\n%s",proc(t,9));
}
『肆』 C語言 term does not evaluate to a function 如何修改
//不知道你要表達什麼意思,看看是不是要這個效果,在VC6。0中通過,
#include<stdio.h>
#include<math.h>
void main ()
{
unsigned int n;
int k,a,b=0;
printf("Input a number n(0<n<65536):");
scanf("%d",&n);
k=1+(n>9)+(n>99)+(n>999)+(n>9999); /*判斷n的位數*/
printf("%d\n",k);
for (;k>=1;k--)
{
a=n/pow(10,k-1);
n%=(int)pow(10,k-1);
b+=a;
printf("%d ",a);
}
printf("\n%d\n",b);
}
『伍』 C語言問題。term does not evaluate to a function
沒有時間看你的演算法
printf("%d",d+e+f+c/4+1(a-(9*e+(4-c%4)*5+(4*d+4-c%4-b)*4))/36);
這一句錯誤在這里+1(a
其他幾句都有類似錯誤
+1(a
1和(之間應該有運算符
『陸』 在c語言中出現term does not evaluate to a function是什麼意思
//不知道你要表達什麼意思,看看是不是要這個效果,在VC6。0中通過,
#include<stdio.h>
#include<math.h>
void main ()
{
unsigned int n;
int k,a,b=0;
printf("Input a number n(0<n<65536):");
scanf("%d",&n);
k=1+(n>9)+(n>99)+(n>999)+(n>9999); /*判斷n的位數*/
printf("%d\n",k);
for (;k>=1;k--)
{
a=n/pow(10,k-1);
n%=(int)pow(10,k-1);
b+=a;
printf("%d ",a);
}
printf("\n%d\n",b);
}