这是我的代码
int main()?
{
float avg, age[] = { 23.4, 55, 22.6, 3, 40.5, 18 };
avg = average(age); /* Only name of array is passed as argument. */
printf("Average age=%.2f", avg);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
编译错误int main():
error: stray '\342' in program
error: stray '\200' in program
error: stray '\213' in program
Run Code Online (Sandbox Code Playgroud) 我试图创建一个非常简单的程序来计算C++中两个对象之间的引力,所以我想为G声明一个宏,其值等于6.754*10 ^ -11,我用它 -
#define G 6.754e-11.0;
Run Code Online (Sandbox Code Playgroud)
但是它产生了很多杂散错误,如下所示 -
aalpanigrahi@aalpanigrahi:~/Desktop/CS/C++/Other PSETS$ g++ gravity.cpp -o gravity
gravity.cpp:5:28: error: stray ‘\342’ in program
#define G (6.754)*pow(10.0,??11.0);
^
gravity.cpp:10:52: note: in expansion of macro ‘G’
float gforce(float m1,float m2,float r){return G*m1*m2/(r*r);}
^
gravity.cpp:5:29: error: stray ‘\210’ in program
#define G (6.754)*pow(10.0,??11.0);
^
gravity.cpp:10:52: note: in expansion of macro ‘G’
float gforce(float m1,float m2,float r){return G*m1*m2/(r*r);}
^
gravity.cpp:5:30: error: stray ‘\222’ in program
#define G (6.754)*pow(10.0,?11.0);
^
gravity.cpp:10:52: note: in expansion of macro ‘G’ …Run Code Online (Sandbox Code Playgroud) 我写了以下代码.它是实现双链表.但错误突然出现.
while(x==1); // This line showed errors
return 1;
Run Code Online (Sandbox Code Playgroud)
错误:
DoublyLinkedList.c: In function `main':
DoublyLinkedList.c:194: error: stray '\226' in program
DoublyLinkedList.c:194: error: stray '\128' in program
DoublyLinkedList.c:194: error: stray '\156' in program
DoublyLinkedList.c:194: error: `The' undeclared (first use in this function)
DoublyLinkedList.c:194: error: (Each undeclared identifier is reported only once
DoublyLinkedList.c:194: error: for each function it appears in.)
DoublyLinkedList.c:194: error: parse error before "list"
DoublyLinkedList.c:194: error: stray '\226' in program
DoublyLinkedList.c:194: error: stray '\128' in program
DoublyLinkedList.c:194: error: stray '\157' …Run Code Online (Sandbox Code Playgroud) 每当我与负数GCC进行比较时,我都会看到:
error: stray '\342' in program
if ( -4 < ÔÇô3 ) return 1;
^
compilation terminated due to -Wfatal-errors.
Run Code Online (Sandbox Code Playgroud)
码:
int main() {
if ( -4 < –3 ) return 1;
return 0;
}
Run Code Online (Sandbox Code Playgroud)