Recommend Programing

General Discussions
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Re: Recommend Programing

Post by Nipuna » Fri Aug 06, 2010 9:05 pm

I am writing this because now i have my free 30 mins.

Please Tell me this.
I want to learn Programing after my exam.

I have found a nice C tutorial from Vidusara news Paper. Now tutorial the is over, it explained the basic. It explained until open and write to files with C. After that tutorial is over. It said it's the basic.
you said me to start programing with C++. So i decided to ask you may i learn C or learn C++ from your tutorial. Or Study both at same time.

I can learn easily with Vidusara news paper's tutorial.

So what i do?

Thanks
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Recommend Programing

Post by Neo » Sat Aug 07, 2010 12:05 am

Nipuna, do not concentrate on these now. I'll guarantee that you can learn everything as you want after your exams. We all will try our best to get you started. But you will not get a chance for your exams again. So give your 100% for that.

Every computer language is capable of doing almost everything. So the most important thing is to learn programming techniques like data structures, algorithms, coding concepts, etc... All these things are easy to learn if you put up a proper plan.

C++ addresses more modern world requirements like Object Oriented Programming than C. Though the syntax and semantics are almost same, these minor differences has made C++ to be the future of C. So you better start with C++.
C# would be another good language to start with. It is getting more popular over other languages in .Net family since it is very close to C/C++.

Anyway, we can discuss all these things after your exams in great detail. So for now, please concentrate your studies. Good luck bro !!!
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Re: Recommend Programing

Post by Nipuna » Sat Aug 07, 2010 1:13 pm

Thanks I will do
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Re: Recommend Programing

Post by Nipuna » Tue Aug 17, 2010 8:31 pm

Neo wrote:I have answered the same question several times :)

C/C++ Tutorial for beginners
I tried this tutorial with Bloodshed Dev C++ but it show some errors. I know Turbo C is good for this but i don't like its interface so please tell me another that compatible with this tutorial.
Bertus
Corporal
Corporal
Posts: 4
Joined: Mon Aug 16, 2010 7:44 pm
Location: The Netherlands

Re: Recommend Programing

Post by Bertus » Tue Aug 17, 2010 11:09 pm

Just like any IDE, DevC++ is perfectly fine for programming c++. I recently started programming myself, and I use it too.
Maybe you can start all over, and re-install it with the following instructions my instructor gave me:

Installation:
Language -> English
Compiler -> Mingw gcc (deselect the MS VC++ 2005 compiler)
I agree -> Yes
Choose Components -> choose all preselected components
Choose Start Menu Folder -> choose preselected folder
Choose Install Location -> choose preselected location

The installation starts, and will take a few minutes.

There is another question about the Dev-c++ first time configuration.
Choose (to save time) O no, I prefer to use C++ without …
First-time configuration:
Select from the menu Tools, select then Editor Options and Display. Check Line Numbers, close the window with Ok.

Select from the menu Tools, select then Environment Options, Files & Directories, and User’s Default Directory. Use the button at the end to browse to choose the default working directory, for example C:\My Documents\MyCppFiles. Close the window with Ok.

Select from the menu Tools, select then Environment Options and General. Check Create Backup Files. Close the window with Ok.
I also added a .doc which explains in detail how to write your first program with Devc++ :)
If you're still having trouble, please post your code and the error you're getting, maybe I can find what's going wrong.
The_use_of_the_Dev.doc
Last edited by Neo on Wed Aug 18, 2010 2:21 am, edited 1 time in total.
Reason: Placed the attached doc to the post using "Place inline"
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Re: Recommend Programing

Post by Nipuna » Wed Aug 18, 2010 8:51 am

Bertus wrote:Just like any IDE, DevC++ is perfectly fine for programming c++. I recently started programming myself, and I use it too.
Maybe you can start all over, and re-install it with the following instructions my instructor gave me:

Installation:
Language -> English
Compiler -> Mingw gcc (deselect the MS VC++ 2005 compiler)
I agree -> Yes
Choose Components -> choose all preselected components
Choose Start Menu Folder -> choose preselected folder
Choose Install Location -> choose preselected location

The installation starts, and will take a few minutes.

There is another question about the Dev-c++ first time configuration.
Choose (to save time) O no, I prefer to use C++ without …
First-time configuration:
Select from the menu Tools, select then Editor Options and Display. Check Line Numbers, close the window with Ok.

Select from the menu Tools, select then Environment Options, Files & Directories, and User’s Default Directory. Use the button at the end to browse to choose the default working directory, for example C:\My Documents\MyCppFiles. Close the window with Ok.

Select from the menu Tools, select then Environment Options and General. Check Create Backup Files. Close the window with Ok.
I also added a .doc which explains in detail how to write your first program with Devc++ :)
If you're still having trouble, please post your code and the error you're getting, maybe I can find what's going wrong.
The_use_of_the_Dev.doc
here is the code

Code: Select all

#include<<iostream>>
using namespace std;
int main ()
{
cout <<"This is my first program. Say hello!";
return 0;
)
I read your code. But please I want to Program like above as the tutorial. This code is easy to remember.
I don't want to Insert this code

Code: Select all

int main (int argc, char *argv{})
I want to use only this code

Code: Select all

int main ()
Thanks
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Recommend Programing

Post by Neo » Wed Aug 18, 2010 11:25 am

The complete form of the "main" function is as follows.

Code: Select all

int main (int argc, char *argv[])
NOTE: after argv, you need to use square brackets (not curly brackets).

This form of "main" is required when you run your exe with command line arguments. For example, say your compiled exe is myprogram.exe. You need to pass some parameters to it. So you run it as below.

Code: Select all

myprogram 15 nipuna 85
Notice that 15, nipuna and 85 are command line arguments. If you run your program as this, argc will be set to 4 and you'll be able to access them using argv as below.

argv[0] is set to "myprogram" (The name of the exe with path is always set to first element)
argv[1] is set to 15
argv[2] is set to "Nipuna"
argv[3] is set to 85

However, if your program doesn't accept command line arguments and doesn't have any return type (simplest form), you can define it as below.

Code: Select all

void main(void)
This is also equals to,

Code: Select all

void main()
If you have a integer return, you can deifne it as below.

Code: Select all

int main()
I'm sure you are now clear on function "main" now.

As Bertus stated, make sure you add your code with compile/link error(s) as nobody will spend time to run your code.

I can see a little mistake in your code. Use #include <iostream> instead of #include<<iostream>>.
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Re: Recommend Programing

Post by Nipuna » Wed Aug 18, 2010 1:06 pm

Neo

I now i understand why I couldn't compile my Program with Dev C++. Because i Coded it as this #include<<iostream>>.
I corrected it as you said #include <iostream>. Now my Program works.

But i can't see anything it executes then despairs.
I think i have to add another core before return 0; isn't it?

Thanks

Here is my Code now.

Code: Select all

#include <iostream>
using namespace std;
int main ()
{
cout <<"This is my first program. Say hello!";
return 0;
}
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Recommend Programing

Post by Neo » Wed Aug 18, 2010 1:41 pm

Add following line before return to wait until you press a key.

Code: Select all

cin.get();
Bertus
Corporal
Corporal
Posts: 4
Joined: Mon Aug 16, 2010 7:44 pm
Location: The Netherlands

Re: Recommend Programing

Post by Bertus » Wed Aug 18, 2010 1:42 pm

Adding a system("PAUSE") will do the trick. So your code will be:

Code: Select all

int main ()
{
cout <<"This is my first program. Say hello!";
system("PAUSE");
return 0;
}
If I were you I wouldn't worry too much about the advanced stuff like the command line parameters. I've been practicing c++ for a couple of months and I also don't know what it all means ;)
So just focus on the basics first, data types, control structures, classes, etc.
Post Reply

Return to “General Discussions”