如何开始学习MinGW C ++? [英] How to get started learning MinGW C++?

查看:142
本文介绍了如何开始学习MinGW C ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习C ++的代码块,我想问你是否可以给我一些好的指标,如何我可以学习MinGW和Visual studio C ++之间的区别,例如 \\\
<< 不总是表现得如我所料。我是完整的新手,只有到第2天的一本旧书自学的C ++在21天由杰西自由和程序看起来像这样:

I'm learning C++ with codeblocks and I'd like to ask if you can post me some good pointers how I can learn the difference between MinGW and Visual studio C++, for example \n and << don't always behave as I'm expecting. I'm complete newbie, only reached day 2 of an old book "Teach yourself C++ in 21 days" by Jesse Liberty and the program looks like this:

#include <iostream>

using namespace std;

    int main()
    {
        cout << "Hello there."; endln;
        cout << "Here is 5: " << 5 << endl;
        cout << "The manipulator endln writes a new line to the screen";
        cout << "Here is a very big number:\t" << 70000;
        cout << "Here is the sum of 8 and 5:\t" << 8+5;
        cout << "Here is a fraction:\t\t" << (float) 5/8;
        cout << "And here is a very big number:\t" << (double) 7000*7000;
        cout << "Remember to replace Niklas with you name";
        cout << "Hampus is a C++ programmer!";
        return 0;
    }

MinGW C ++与GNU C ++相同吗?有官方标准吗?任何关于新手学习/教学的建议都会被推崇。我下面的书是教你自己的C ++在21天,它是和旧版本的书,但我可以修改程序从第一个练习运行,我相信我可以使用这本书,因为也许没有很多变化

Is MinGW C++ the same as GNU C++? Is there an official standard? any advice for newbie learning / teaching will be appriciated. The book I'm following is "Teach yourself C++ in 21 days" and it is and old edition of the book but I could modify the programs from the first exercise to run and I believe I can use the book since perhaps not many changes were made to the basic C++ since it was published (the edition of the book I own is maybe 10 years old).

谢谢!

更新
在此处获得建议后,我购买了 C ++ Primer

推荐答案

应该执行:P)是写在标准的东西。标准定义行为,而不是实现,因此编译器可能不同。

The only thing that compiler has to enforce (or SHOULD enforce :P) is stuff that's written in standard. Standard defines behavior, not the implementation, therefore compilers can differ.

首先,代码:: blocks不是一个编译器,它是一个人们通常使用MinGW编译器。另一方面,Visual Studio是一个环境,恰好与它自己的编译器。

First of all, code::blocks is not a compiler, it's an environment in which people usually use MinGW compiler. Visual Studio on the other hand is an environment that just happens to come with it's own compiler.

编译器之间的区别应该不是你作为一个开始的c ++程序员和文本编辑器或开发人员。你想使用的环境取决于你,你可以在PSpad中编程(编写代码),然后你可以用百万不同的编译器编译它。

Differences between compilers should be of no concern for you as a beginning c++ programmer and text editor or dev. environment you want to use is up to you, you can program (write the code) in PSpad and then you can compile it with million different compilers.

总结,有一个标准,编译器必须(或应)遵守。编译器实现它,无论他们喜欢什么,他们可能会添加一些额外的东西(如可变大小的数组静态分配。)注意,标准什么也不知道这些扩展,因此没有定义他们的行为。

To sum it up, there's a standard to which compilers have to (or should) comply. Compilers implement that in whatever way they like and they may add some extra things (like variable size arrays static allocation.) Notice that standard knows nothing about those extensions and therefore doesn't define their behavior.

然后有一个文本编辑器,你可以编写你的代码并用任何你想要的编译器编译它。

Then there's a text editor of some kind, in which you write your code and compile it with whatever compiler your heart desires.

C ++不是一个容易的语言学习,除非你以前的经验与低级(仍然高级:))编程语言。特别是如果你还没有遇到指针和引用。

C++ is not an easy language to learn unless you have prior experience with lower-level (still high level :)) programming language. There's a lot going on especially if you haven't encountered pointers and references yet.

我建议你得到一本新书,甚至可能包含关于c ++ 0x / c的信息

I suggest you get a new book possibly even containing information on c++0x / c++11 standard which was officially released couple of months ago.

此外,不要使用(double)x 这种类型的ceco在c ++中,因为它真的是一个c方式的铸造类型。使用 static_cast< double> (x)。 (还有其他投射方式。)

Also, don't use (double)x this kind of typecasting in c++ since it's really a c-way of casting types. Use static_cast < double > (x) in this scenario. (There are other ways to cast too.)

这篇关于如何开始学习MinGW C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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