Friday, May 27, 2011

Exercise of i++ vs ++i

exercise:
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
int i;

cout << "Test on i++ \n";
i = 0;
cout << i++ << "\n\n";

while(i++ <= 10){
cout << i << "\n";
}

cout << "\n";
cout << "Test on ++i \n";
i = 0;
cout << ++i << "\n\n";

while(++i <= 10){
cout << i << "\n";
}

system("PAUSE");
return EXIT_SUCCESS;
}


Exercise of i++ vs ++i

HelloWorld using Dev-C++

To create the first "HelloWorld" using Dev-C++:

Click File -> New Project to create a new C++ project using template of Console Application, with name of HelloWorld.
Create a New Project...

Select your target folder when you are asked to do so.

A dummy code will be generate with the code:
system("PAUSE");
return EXIT_SUCCESS;

auto generated code

Just keep it as is. It's used to keep the console window not to close after your application close, such that you can see you output.

Add one line of code to finished your first "Hello World".
cout << "Hello World\n"; insert code

Save your file.

Click Execute -> Compile & Run.
HelloWorld using Dev-C++

Dev-C++: IDE for C/C++ programming language on Windows

Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it's compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based compiler.



Features are :



- Support GCC-based compilers

- Integrated debugging (using GDB)

- Project Manager

- Customizable syntax highlighting editor

- Class Browser

- Code Completion

- Function listing

- Profiling support

- Quickly create Windows, console, static libraries and DLLs

- Support of templates for creating your own project types

- Makefile creation

- Edit and compile Resource files

- Tool Manager

- Print support

- Find and replace facilities

- CVS support



http://www.bloodshed.net/devcpp.html