请问下面#include<iostream.h>什么地方出错了?

#include <iostream.h>
vodi myFunction();
int a=1,b=2;
main()
{
cout<<" Function main:a="<<a<<"\n";
cout<<" Function main:b="<<b<<"\n";
cout<<" Function main:a+b="<<a+b<<"\n";
myFunction();
}
void myFunction()
{
int c=3;
cout<<" Function myFunction:a="<<a<<"\n";
cout<<" Function myFunction:b="<<b<<"\n";
cout<<" Function myFunction:c="<<c<<"\n";
cout<<" Function myFunction:a+b-c="<<a+b-c<<"\n";
}

守着星空守着你
浏览 267回答 2
2回答

Helenr

vodi myFunction();是void还有 换行c++是endl 不是"\n";应该是cout<<endl;

森林海

出错原因:代码写的太少了,多练习。C语言的习惯影响了你。熟能生巧,呵呵。新手吧==========================正确代码=====================================#include <iostream.h>void myFunction();int a=1,b=2;main(){cout<<" Function main:a="<<a<<endl;cout<<" Function main:b="<<b<<endl;cout<<" Function main:a+b="<<a+b<<endl;myFunction();}void myFunction(){int c=3;cout<<" Function myFunction:a="<<a<<endl;cout<<" Function myFunction:b="<<b<<endl;cout<<" Function myFunction:c="<<c<<endl;cout<<" Function myFunction:a+b-c="<<a+b-c<<endl;}&nbsp;
打开App,查看更多内容
随时随地看视频慕课网APP