主要和变量的错误 [英] errors regarding main and variables

查看:136
本文介绍了主要和变量的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

i想出了一个代码,并且编译器正在标记错误,例如:

1.新类型可能无法在返回类型中定义

2.新类型可能无法在返回类型中定义

3.`main'必须返回`int'



请帮帮我

这里是整个代码的链接,

因为我不知道要显示哪部分代码。

< a href =http://pastebin.com/embed_js.php?i=42rEjd46>链接 [在新窗口中打开]

解决方案

一些问题;



1.你应该包括 iostream ,而不是 iostream.h

2.类声明必须以;

3.将 main 的返回类型从 void 更改为 int



我想你希望你的代码看起来更像这样;



  #include   <   iostream  >  

使用 命名空间标准;

class crcpara
{
public
void chooser_disp()
{
cout<< \t no:海洋名称\ n;
cout<< \t 1 Indian ocean \\\
;
cout<< \t 2 pacific ocean \\\
;
cout<< \t 3 atlantic ocean \\\
;
cout<< \t 4 articic ocean \\\
;
}
};

int main()
{
crcpara plm;
cout<< 你好,这个程序是针对enterpreuners而不是针对孩子的,所以要小心<< endl ;
cout<< 请选择要在<< endl;
plm.chooser_disp();
cin.get();
return 0 ;
}





希望这会有所帮助,

Fredrik


< blockquote>因为它类似于使用tc ++或bc ++代码复制而不是



vs vc ++ .net或vc#有一些不同的写法并为结构分配内存。



你必须为我写一个你在其中写c代码的软件。


hello everyone,
i came up with a code, and the compiler is flagging errors such as:
1. new types may not be defined in a return type
2. new types may not be defined in a return type
3. `main' must return `int'

please help me
here's the link to the whole code,
because i donno which part of the code to display.
link[open in a new window]

解决方案

A few issues;

1. You should include iostream, not iostream.h
2. The class declaration must end with ;
3. Change the return type of main from void to int

I think you want your code to look more like this;

#include<iostream>

using namespace std;

class crcpara
{
public:
	void chooser_disp()
	{
		cout << "\t no:      name of the ocean \n";
		cout << "\t 1        Indian ocean \n";
		cout << "\t 2        pacific ocean \n";
		cout << "\t 3        atlantic ocean \n";
		cout << "\t 4        articic ocean \n";
	}
};

int main()
{
	crcpara plm;
	cout << " hello, this program is for enterpreuners and NOT for kids, so maintain caution "<<endl;
	cout << " please choose the ocean which your going to fish in "<<endl;
	plm.chooser_disp();
	cin.get();
	return 0;
}



Hope this helps,
Fredrik


because it is similiar to use tc++ or bc++ code that copy in vs.

vs in vc++.net or vc# have some different writing and assign memory to structures.

you must write for me which software you write c codes in it .


这篇关于主要和变量的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆