| Forum |
|
|||||||
| Programming The destination for developers - C, C++, Java, Python and the lot |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Right Off the Assembly Line
Join Date: Jul 2007
Posts: 10
|
Code:
#include <iostream>
using namespace std;
main()
{ int a,b,c;
cout<<"Enter two nos.:";
cin>> a >> b;
c=a+b;
cin.get();
cout<<"Sum is"<<c<<"";
cin.get();
}
|
|
|
| Advertisements. Register and be a member of the community to get rid of them. | |
|
Advertisement
|
|
|
|
#3 (permalink) | |
|
The Frozen Nova
Join Date: Sep 2004
Location: Trespasser in Virtual Land
Posts: 1,641
|
May I know which compiler are you using.
This program will run properly Quote:
__________________
I dream of a better tomorrow... where chickens can cross roads and not have their motives questioned. www.nerdweed.blogspot.com |
|
|
|
|
|
#4 (permalink) |
|
Wise Old Crow
Join Date: Apr 2005
Location: Inside the Pixel
Posts: 1,227
|
Is there any need to use instances of cin.get() ?
See in the Output window of the compiler. u might see the result/ o/p their. Try using getch(); function instead at the end. Try using getch(); function in the end instead.
__________________
http://twitter.com/blueshift155 Last edited by blueshift; 08-08-2007 at 10:16 PM. Reason: Automerged Doublepost |
|
|
|
|
#5 (permalink) | |
|
In The Zone
Join Date: May 2007
Location: Pune
Posts: 247
|
Quote:
When supplying input add a space between the numbers. Even current program runs fine in MSVC6. Which compiler you are using? Also if using Tubro C++ 3 or similar DOS based compiler, then remember they are really old. Instead try using free Microsoft VC++ Express Edition which is based on current standard.
__________________
Anyone who has never made a mistake has never tried anything new |
|
|
|
|
|
#7 (permalink) | |
|
NP : Crysis
Join Date: Mar 2007
Location: City 17
Posts: 1,415
|
leave out all the complications. just run
Quote:
__________________
Gaming: Phenom II x4 965BE @ 3.6Ghz/Corsair H50 Liquid Cooling/MSI 790FX-GD70/2x2GB GSkill Ripjaws 7-7-7-24/3 x GTX 470 w/Zalman VF3000F/Corsair 850W PSU/Antec 1200/2xSpinpoint F3 500Gb RAID 0 |
|
|
|
|
|
#8 (permalink) |
|
In The Zone
Join Date: Sep 2004
Location: Bermuda Triangle
Posts: 239
|
Don.t forget to add the main() function too...
Code:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cin>>a>>b;
cout<<a+b;
getch();
}
__________________
In just two days, tomorrow will be yesterday. |
|
|
|
|
#11 (permalink) | ||
|
Right Off the Assembly Line
Join Date: Jul 2007
Posts: 10
|
I am using bloodshed Cev C++ which i got from a Digit CD
Quote:
Quote:
|
||
|
|
|
|
#12 (permalink) |
|
Alpha Geek
Join Date: Jul 2004
Location: New Delhi
Posts: 617
|
Why not simply use Turbo C++???
It's much better & easy to use for starters. Here's the link to Turbo C++ http://rapidshare.com/files/47910015/TURBOC.EXE Download it, open the file using Winzip or Winrar and extract it to C: drive. Be sure to check that the option to use path names is checked otherwise the files will overwrite themselves & u'll have a corrupt complier in your hands. Do Not execute the file directly by double clicking on it.
__________________
Dell Studio 1558, Intel i5 M430 @ 2.27 Ghz, 4 GB RAM, 1 GB ATI 5470 Mobility, 500 GB HDD, IDT HD Audio with Creative X-Fi MB software Last edited by g_goyal2000; 10-08-2007 at 12:30 AM. Reason: Automerged Doublepost |
|
|
|
|
#13 (permalink) | |
|
The Frozen Nova
Join Date: Sep 2004
Location: Trespasser in Virtual Land
Posts: 1,641
|
Dint want to start a new thread as problem with the compiler in question.
When I run a Hello world program in C using Dev-CPP, I get the following error. Quote:
__________________
I dream of a better tomorrow... where chickens can cross roads and not have their motives questioned. www.nerdweed.blogspot.com |
|
|
|
|
|
#14 (permalink) | ||||
|
In The Zone
Join Date: May 2007
Location: Pune
Posts: 247
|
Quote:
Quote:
Quote:
Quote:
__________________
Anyone who has never made a mistake has never tried anything new |
||||
|
|
|
|
#15 (permalink) |
|
||uLtiMaTE WinNER||
Join Date: Nov 2006
Location: Kathmandu,Nepal
Posts: 698
|
Hey
I hv also just started C++........May be thsi will help u...... Code:
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int a,b;
cin>>a>>b;
cout<<a+b;
getch();
}
Code:
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int a,b;
cout<<"input 1st no";
cin>>a;
cout<<"input 2nd no";
cin>>b;
cout<<a+b;
getch();
}
__________________
||uLtiMaTE WinNER|| |
|
|
|
|
#16 (permalink) |
|
God of Mistakes...
Join Date: Dec 2005
Location: Pune, Maharashtra
Posts: 1,905
|
Let me post a good ANSI C++ Program ...
Code:
# include <iostream>
using namespace std;
int main()
{
int a,b,c;
cout << "Enter two numbers : ";
cin >> a >> b;
c = a + b;
cout << "Addition = " << c << endl ;
system ("PAUSE");
return 0;
}
@ Ron Let me tell u bro, the newer versions, there is no need to use ".h" in names of header files. If u use them, they are considered as backward headers. But, if u r using OLD TC3 compiler, then it should be there. Also using namespaces std; will NOT work in that compiler. Better to go for new standards. U my try Dev C++
__________________
Registered Linux User #468778 ---------------------------------- http://twitter.com/_Garbage_ Last edited by Garbage; 10-08-2007 at 04:13 PM. Reason: Automerged Doublepost |
|
|
|
|
#17 (permalink) | |
|
||uLtiMaTE WinNER||
Join Date: Nov 2006
Location: Kathmandu,Nepal
Posts: 698
|
Quote:
Do u hv some basic tutorial.....as I am unable to get the tutorail...........Our School teacher is mad.....She is teaching us carelessly.without giving any notes............It is out of our Ncert course book...........I am studing in class 10...... .. .......Can i get the link of Dev C++................
__________________
||uLtiMaTE WinNER|| |
|
|
|
|
|
#18 (permalink) | |
|
The Lord of Death
Join Date: May 2005
Location: यमलोक
Posts: 253
|
Quote:
Read more about it - http://www.gidnetwork.com/b-61.html |
|
|
|
|
|
#19 (permalink) | |||||
|
God of Mistakes...
Join Date: Dec 2005
Location: Pune, Maharashtra
Posts: 1,905
|
@Ron ,
From HERE u can download Dev C++ Quote:
Quote:
Quote:
Quote:
Quote:
Hope this is clear now !!!
__________________
Registered Linux User #468778 ---------------------------------- http://twitter.com/_Garbage_ Last edited by Garbage; 10-08-2007 at 08:11 PM. Reason: Automerged Doublepost |
|||||
|
|
|
|
#20 (permalink) |
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,657
|
C/C++ sources are portable if you write it for portability (w/o OS sensitive stuff). Programs aren't, right.
Why bother with IDEs and all when you've just started learning. Get a good Linux distro and G++/CC your way through the code.
__________________
Harsh J www.harshj.com |
|
|
|
|
#21 (permalink) |
|
damn busy...
Join Date: Sep 2006
Location: Jhansi/Meerut
Posts: 1,973
|
i am using turbo c++ ver 3.0 from the last 18 months . I am in 12th now and the computer teacher is very impressed from my programming skills.though i don't know programming very deeply but according to ISC board standards it is sufficient.
can any1 tell me from where to download the latest version.I am low on bandwidth that's why i am not downloading the rapidshare link given bu goyal2000. i want 2 download the latest version
__________________
MSI GX660 with ATI 5870 Dell Studio 15(1555) 1TB+1.5TB external|N86|ZTE Blade|5230|E63|EP-630|Soundmagic PL50|Sennheiser CXL 400|Meelec M11P+ www.techjunkiez.com |
|
|
|
|
#22 (permalink) | |
|
C# Be Sharp !
Join Date: Jun 2006
Location: Toronto
Posts: 1,805
|
Quote:
also , Turbo C++ does NOT run fine under Windows XP(which is what the majority uses)
__________________
There are 10 types of people in the world: those who understand binary and those who do not. |
|
|
|
|
|
#23 (permalink) |
|
The Frozen Nova
Join Date: Sep 2004
Location: Trespasser in Virtual Land
Posts: 1,641
|
Thx Zeeshan for nice info. Can someone sort out the problem I mentioned in Post #13
__________________
I dream of a better tomorrow... where chickens can cross roads and not have their motives questioned. www.nerdweed.blogspot.com |
|
|
|
|
#24 (permalink) |
|
damn busy...
Join Date: Sep 2006
Location: Jhansi/Meerut
Posts: 1,973
|
turbo c++ consumes 100 % cpu on my p4 3 GHz system .unbelievable
__________________
MSI GX660 with ATI 5870 Dell Studio 15(1555) 1TB+1.5TB external|N86|ZTE Blade|5230|E63|EP-630|Soundmagic PL50|Sennheiser CXL 400|Meelec M11P+ www.techjunkiez.com |
|
|
|
|
#25 (permalink) |
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,657
|
I think all 16-bit apps do that?
@casanova - Try reinstalling GCC packages? Looks like an incomplete or limited installation which is thus reporting cc1.exe is missing..
__________________
Harsh J www.harshj.com Last edited by QwertyManiac; 11-08-2007 at 04:05 PM. Reason: Automerged Doublepost |
|
|
|
|
#26 (permalink) | |
|
I am Optimus Prime
Join Date: Feb 2005
Location: Delhi, India
Posts: 1,919
|
Quote:
|
|
|
|
|
|
#27 (permalink) | |
|
In The Zone
Join Date: May 2007
Location: Pune
Posts: 247
|
Quote:
__________________
Anyone who has never made a mistake has never tried anything new |
|
|
|
|
|
#29 (permalink) | |
|
I am Optimus Prime
Join Date: Feb 2005
Location: Delhi, India
Posts: 1,919
|
Quote:
|
|
|
|
|
|
#30 (permalink) |
|
The Frozen Nova
Join Date: Sep 2004
Location: Trespasser in Virtual Land
Posts: 1,641
|
@sandeepk
Don't start TC from windows. Go to command prompt, then navigate to tc and then start it from there. U won't have any problem @qwerty I had made a full install. Is it coz I am using Vista?
__________________
I dream of a better tomorrow... where chickens can cross roads and not have their motives questioned. www.nerdweed.blogspot.com |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| serial numbers of win xp sp2 | pravesh_4766 | Software Q&A | 3 | 30-04-2006 08:32 PM |
| Usb pin numbers | beyondthegracefgod | Peripherals | 5 | 07-11-2004 02:51 PM |