C++ compiler to write not-very-complex DOS/text-based programmes

In summary, Krisohn would recommend using a free compiler, Visual Studio 2008, for writing not-very-complex DOS/text-based programmes.
  • #1
PainterGuy
940
69
hello,

would you kindly recommend me some simple C++ compiler programme to write not-very-complex DOS/text-based programmes? I'm new to C++, is one supposed to write pseudo-code into the compiler or instructions in terms some high level language? kindly let me know. thanks.
 
Technology news on Phys.org
  • #2
To write code I usually use Visual Studio 2008, its a great program but it isn't free.The only reason I use it is because I get it free through my university's agreement with Microsoft.

For a free compiler, I used and would recommend Dev-C++, in which you can both edit your code and compile it. I didn't use it as a code editor though, I used it solely as a compiler. For editing code I would recommend notepad++.

And you don't write any kind of pseudo code into the compiler, the only time you should ever use pseudo code is if you are having trouble coming up with the solution to your problem using straight code, then you can work through it using a mix of English and C++.
 
  • #3
Or go the open source route with cygwin.com and GCC...
 
  • #4
KrisOhn said:
To write code I usually use Visual Studio 2008, its a great program but it isn't free.The only reason I use it is because I get it free through my university's agreement with Microsoft.

thanks, Krisohn. someone i know has visual studio and can get it. what is so special about it?

KrisOhn said:
For a free compiler, I used and would recommend Dev-C++, in which you can both edit your code and compile it. I didn't use it as a code editor though, I used it solely as a compiler. For editing code I would recommend notepad++.

i don't see the importance of saying "you can both edit your code and compile it...". when you write something in notepad or ms word, you can obviously edit anything and complete the document. a compiler is in other words a translator as far as i know - translating one language into another. suppose you're writing a code and have written " x >=y". but then you find it wrong and would want to edit to "x <=y". am i missing some understanding here? perhaps, editing in this context has some different meaning. show me the right path, please.
 
  • #5
I think there is a free version of Visual C++ - limited, but can suit your needs.
 
  • #6
painterguy said:
thanks, Krisohn. someone i know has visual studio and can get it. what is so special about it?

Everything you need is right there with this program. You can easily compile and write your code and keep track of all your files in your different programs, which makes for a very easy time writing modular programs. I only use this program to write complex code, code that is usually written over many C++/header files, for everything else, I use notepadd++.


i don't see the importance of saying "you can both edit your code and compile it...". when you write something in notepad or ms word, you can obviously edit anything and complete the document. a compiler is in other words a translator as far as i know - translating one language into another. suppose you're writing a code and have written " x >=y". but then you find it wrong and would want to edit to "x <=y". am i missing some understanding here? perhaps, editing in this context has some different meaning. show me the right path, please.

What I meant here was that most compilers only have the option to compile your code for you. You load a file into the compiler, compile it, and it pops out an executable file. With this compiler you can load the file into the compiler, and edit the code in the file, instead of having to switch back and forth between programs. But notice that I didn't use it for this purpose, the code editor in that compiler is not the greatest and I had some troubles with it. I still think to this day that for making simple programs, notepad++ is the best route to go.
 
  • #7
KrisOhn said:
Everything you need is right there with this program. You can easily compile and write your code and keep track of all your files in your different programs, which makes for a very easy time writing modular programs. I only use this program to write complex code, code that is usually written over many C++/header files, for everything else, I use notepadd++.

i've never written a programme. will do this in next two weeks. before this i need to get everything ready. now i understand notepad++ is a general purpose text editor and also works as source code editor but not a compiler.

KrisOhn said:
What I meant here was that most compilers only have the option to compile your code for you. You load a file into the compiler, compile it, and it pops out an executable file. With this compiler you can load the file into the compiler, and edit the code in the file, instead of having to switch back and forth between programs. But notice that I didn't use it for this purpose, the code editor in that compiler is not the greatest and I had some troubles with it. I still think to this day that for making simple programs, notepad++ is the best route to go.

what is this "file"?

perhaps you are saying that most compilers out there don't have the ability to edit exe files.

yes, i do believe that notepad++ is the best route but still it's not a compiler. i would still need a separate compiler but could use notepad++ for editing. what do you say?

cheers
 
  • #8
.exe files are compiled machine code known as "binaries". A compiler takes human readable source code and compiles them into machine executable .exe files.

Get visual c++ express from here, it will meet all your needs for now

http://www.microsoft.com/express/Windows/
 
Last edited by a moderator:
  • #9
painterguy said:
what is this "file"?

perhaps you are saying that most compilers out there don't have the ability to edit exe files.

yes, i do believe that notepad++ is the best route but still it's not a compiler. i would still need a separate compiler but could use notepad++ for editing. what do you say?

cheers

The file is the .cpp file that you write your source code within.

There aren't any compilers that can edit .exe files, .exe files cannot be edited. If you want to edit a .exe file you must edit the .cpp file that the source code is within and then recompile the program.

And yes, notepadd++ is not a compiler, but Dev-C++ is, that is what I mean, using notepad++ to edit the source code files and then using Dev-C++ to compile. But any of these Visual Studio suggestions will do both for you just fine.
 
  • #10
KrisOhn said:
The file is the .cpp file that you write your source code within.

There aren't any compilers that can edit .exe files, .exe files cannot be edited. If you want to edit a .exe file you must edit the .cpp file that the source code is within and then recompile the program.

And yes, notepadd++ is not a compiler, but Dev-C++ is, that is what I mean, using notepad++ to edit the source code files and then using Dev-C++ to compile. But any of these Visual Studio suggestions will do both for you just fine.

thanks everyone above who has helped me.

.cpp contains source code written in c++. I'm confused. sorry for sounding so dumb. which programme is used to create .cpp files (or, to write source code). i was under the impression until now that you open compiler and start writing source code there as you write in ms word, and then click some button to get an exe file which could then be run in the dos. any help would be greatly appreciated!
 
  • #11
painterguy said:
thanks everyone above who has helped me.

.cpp contains source code written in c++. I'm confused. sorry for sounding so dumb. which programme is used to create .cpp files (or, to write source code).

notepadd++ creates the .cpp file

i was under the impression until now that you open compiler and start writing source code there as you write in ms word, and then click some button to get an exe file which could then be run in the dos. any help would be greatly appreciated!

This is how it works with Visual Studio, which is probably the best route for you to take.
 
  • #12
thanks for letting me know this, KrisOhn. by the way does a compiler check the source code for any mistakes? if it doesn't then how do you check the source for mistakes as you check a text documents for spelling and grammar mistakes? thanx
 
  • #13
painterguy said:
does a compiler check the source code for any mistakes?

Sure it checks if the syntax is correct. It doesn't check if the program does what you wanted it you to do.
 
  • #14
painterguy said:
thanks for letting me know this, KrisOhn. by the way does a compiler check the source code for any mistakes? if it doesn't then how do you check the source for mistakes as you check a text documents for spelling and grammar mistakes? thanx

Yep, just like Borek said it checks it for things called compiler errors, they are problems with the actual writing of the code itself, such as syntax, and improper statements.
But it doesn't find things called run time errors which are errors that pop up from code that is written correct enough to be compiled, but doesn't do what you want it to do. An example of a run time error would be the programming outputting 0, when you want it to output 5; both are valid output but only one is correct.
 
  • #15
bravo. this forums is so cool. i look to learn a lot. thanxx everyone. would ask any questions i had soon. cheers
 
  • #16
hi once again,

is there software available which decompile a programme into source code again?

i was reading an intrductory book on computer which is very popular here which says there is another kind of software closely related to compiler called interpreter which checks every statement in the code 1 by 1 hence its easy to detect errrors.

could u please tell me of some very easy c++ book for a beginer with no past knowledge of programming and computers inner working.
 
  • #17
painterguy said:
is there software available which decompile a programme into source code again?

No.

i was reading an intrductory book on computer which is very popular here which says there is another kind of software closely related to compiler called interpreter which checks every statement in the code 1 by 1 hence its easy to detect errrors.

Debugger. Interpreter is something completely different.
 
  • #18
painterguy said:
hi once again,

is there software available which decompile a programme into source code again?

i was reading an intrductory book on computer which is very popular here which says there is another kind of software closely related to compiler called interpreter which checks every statement in the code 1 by 1 hence its easy to detect errrors.

Borek said:
No.

Debugger. Interpreter is something completely different.

Several years ago (about 20) I had an application that could disassemble an executable (.exe file) and display assembly code. If you understood assembly code, you could in theory understand what the executable was doing and how it was doing it, but this is a long way from displaying the source code in C or C++ or whatever language the executable program was written in.

Programs and DLLS that are written in languages supported by the .NET Framework can be disassembled and displayed in a number of languages, including IL (intermediate language, similar to an assembly language), C#, VB, Delphi, and others. This is pretty close to being able to see the source code for the program or DLL.

Yes, a debugger, not an interpreter, is what the book you were reading was describing. With a debugger you can set a breakpoint at a particular statement, and then single-step through the statements that follow, noting the values of variables at each step. Modern debuggers have lots of features.

An interpreter is one of three kinds of program translaters, with the others being compilers and assemblers.

An interpreter translates one statement in your source code into machine code, and then executes it, and continues through your program in this way.

A compiler translates your source code into machine code all at once. Another program, the linker, brings in the necessary addresses in library files so that your program can do input, output, and other useful things. The linker takes the object code produced by the compiler, and adds the necessary machine code, to produce an executable.

An assembler is like a compiler, but works with source code written in some assembly language, instead of a higher-level language such as C, C++, Fortran, etc. An assembler translates assembly source code to machine code. Typically, a linker is also used to produce an executable.
 
  • #19
Mark44 said:
Several years ago (about 20) I had an application that could disassemble an executable (.exe file) and display assembly code. If you understood assembly code, you could in theory understand what the executable was doing and how it was doing it, but this is a long way from displaying the source code in C or C++ or whatever language the executable program was written in.

I have used several disassemblers as well, but that's not what the OP had on mind; I have seen the same question asked too many times by greenhorns to have any doubts :smile:
 
  • #20
Borek said:
I have used several disassemblers as well, but that's not what the OP had on mind; I have seen the same question asked too many times by greenhorns to have any doubts :smile:

Hah, I remember asking that very question myself, and yes, I surely meant going straight from an executable to the source code that I had written in C.

Taught me to save every source file I have ever written.
 
  • #21
Is your goal to make this game or to learn C++ in particular? If it's the former, I'd recommend some other language like Ruby or Python. They're both much more powerful than C++ while also being much easier to learn and use.

Hell, even if your eventual goal is to learn programming in general, learning these high level languages will be more productive that trying to learn C right away. Imperative programming languages are basically all the same anyway so once you learn one, it'll be trivial to learn another...
 

1. What is a C++ compiler?

A C++ compiler is a software tool that translates human-readable C++ code into machine-readable instructions that can be executed by a computer. It is an essential tool for creating programs in the C++ programming language.

2. Can I use a C++ compiler to write DOS/text-based programs?

Yes, a C++ compiler can be used to write DOS/text-based programs. In fact, C++ was originally designed for developing system software, making it a popular choice for creating programs that run in a command-line environment.

3. What are the advantages of using a C++ compiler for creating DOS/text-based programs?

One of the main advantages of using a C++ compiler for DOS/text-based programs is its speed and efficiency. C++ is a low-level language that allows for direct manipulation of hardware, making it a powerful choice for creating fast and lightweight programs. It also has a large standard library and support for various data types, making it versatile for a wide range of programming tasks.

4. Do I need to have a deep understanding of C++ to use a compiler for creating DOS/text-based programs?

While having a good understanding of C++ is beneficial, it is not necessary to have a deep understanding to use a C++ compiler for creating DOS/text-based programs. Many compilers have user-friendly interfaces and provide helpful error messages to assist with troubleshooting. It is still important to have a basic understanding of C++ concepts, such as data types and control structures, in order to write functional programs.

5. Are there any free C++ compilers available for creating DOS/text-based programs?

Yes, there are several free C++ compilers available for creating DOS/text-based programs, such as Turbo C++, GCC, and DJGPP. These compilers can be downloaded and used for personal or commercial purposes without any cost. However, it is important to carefully read and follow the license agreements for each compiler to ensure proper usage.

Similar threads

Replies
6
Views
1K
  • Programming and Computer Science
Replies
7
Views
656
  • Programming and Computer Science
2
Replies
49
Views
3K
  • Programming and Computer Science
Replies
25
Views
14K
  • Programming and Computer Science
Replies
14
Views
4K
  • Programming and Computer Science
2
Replies
59
Views
7K
  • Programming and Computer Science
Replies
14
Views
4K
  • Programming and Computer Science
Replies
23
Views
2K
  • Programming and Computer Science
Replies
5
Views
7K
Back
Top