主题:C++函数调用问题
我是初学C++的,在函数调用不是很理解。以下是写的一个程序,编译时提示4个错误,请高手指正一下,谢谢!
#include <iostream.h>
int call_1(int);//注意函数原型
main()
{
int a=5;
int b;
b=call_1(a);
cout<<"a is "<<a "b is "<<b<<"\n";
}
int call_1(a)
{
a+=5;
return a;
}
提示的错误:
test.cpp
F:\test.cpp(12) : error C2143: syntax error : missing ';' before 'string'
F:\test.cpp(12) : error C2296: '<<' : illegal, left operand has type 'char [6]'
F:\test.cpp(14) : warning C4508: 'main' : function should return a value; 'void' return type assumed
F:\test.cpp(15) : error C2065: 'a' : undeclared identifier
F:\test.cpp(16) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
Error executing cl.exe.
请高手指点要怎么修改。
#include <iostream.h>
int call_1(int);//注意函数原型
main()
{
int a=5;
int b;
b=call_1(a);
cout<<"a is "<<a "b is "<<b<<"\n";
}
int call_1(a)
{
a+=5;
return a;
}
提示的错误:
test.cpp
F:\test.cpp(12) : error C2143: syntax error : missing ';' before 'string'
F:\test.cpp(12) : error C2296: '<<' : illegal, left operand has type 'char [6]'
F:\test.cpp(14) : warning C4508: 'main' : function should return a value; 'void' return type assumed
F:\test.cpp(15) : error C2065: 'a' : undeclared identifier
F:\test.cpp(16) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
Error executing cl.exe.
请高手指点要怎么修改。