User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 425,961 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,688 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 707 | Replies: 7
Reply
Join Date: Mar 2007
Location: DHAKA, Bangladesh
Posts: 21
Reputation: rockbd is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rockbd's Avatar
rockbd rockbd is offline Offline
Newbie Poster

Question output window for c++!!! help!!

  #1  
Feb 18th, 2008
hello!! i am a new programmer!! i started with turbo c 4.5.
just installed borland Turbo c++. the used same codes as 4.5 but got problem with output screen. i cant see the programs output screen after the program ends!!
can anybody tell me how to active it?
Yahoo & msn id: bmwrock0616 hi5: rock1986.hi5.com
Google: shamim.arafat@gmail.com youtube: rocksworld1986
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,779
Reputation: niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all 
Rep Power: 11
Solved Threads: 185
niek_e's Avatar
niek_e niek_e is offline Offline
Posting Virtuoso

Re: output window for c++!!! help!!

  #2  
Feb 18th, 2008
Turbo C++ is really outdated... You could try downloading a newer (free) IDE like Visual Studio Express or Bloodshed .

For your problem:

Put a std::cin.get(); just before you return 0;.
(Or getchar() when using C)

Niek
Last edited by niek_e : Feb 18th, 2008 at 10:55 am.
Want better/more replies to your questions? Wrap your code in [code] [/code] tags!
do NOT pm me for help, in the best case, you'll get ignored
Reply With Quote  
Join Date: Mar 2007
Location: DHAKA, Bangladesh
Posts: 21
Reputation: rockbd is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rockbd's Avatar
rockbd rockbd is offline Offline
Newbie Poster

Re: output window for c++!!! help!!

  #3  
Feb 18th, 2008
this is a new turbo c++ compiler released in sept 2006. unfortunately your code causes an error

[C++ Error] Unit1.cpp(27): E2316 'cin' is not a member of 'std'

here's the full code:



#include<stdio.h>

int main()
{
float s=0,n=0,k=1;

printf("Enter the value of n\n");
scanf("%f",&n);

do
{
s=(s+(1/k));
k=(k+1);
}
while(n>=k) ;



printf("The sum = %f",s);

std::cin.get();
return 0;


}
Yahoo & msn id: bmwrock0616 hi5: rock1986.hi5.com
Google: shamim.arafat@gmail.com youtube: rocksworld1986
Reply With Quote  
Join Date: Jan 2008
Posts: 1,769
Reputation: VernonDozier is just really nice VernonDozier is just really nice VernonDozier is just really nice VernonDozier is just really nice VernonDozier is just really nice 
Rep Power: 8
Solved Threads: 218
VernonDozier VernonDozier is offline Offline
Posting Virtuoso

Re: output window for c++!!! help!!

  #4  
Feb 18th, 2008
You have not included the library that cin comes from (iostream) and you have not told the compiler that when you use the word "cin", you are referring to the function "cin" from iostream.

Try adding these two lines at the top of your program:
#include <iostream>
using namespace std;

edit: You already did the "std" part in the code body. Sorry. You just need the first line.
Last edited by VernonDozier : Feb 18th, 2008 at 11:47 am. Reason: mistake
Reply With Quote  
Join Date: Mar 2007
Location: DHAKA, Bangladesh
Posts: 21
Reputation: rockbd is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rockbd's Avatar
rockbd rockbd is offline Offline
Newbie Poster

Re: output window for c++!!! help!!

  #5  
Feb 18th, 2008
thanks. but the problem was fixed by this :

cin.ignore().ignore() ;

thanks anyway.
Yahoo & msn id: bmwrock0616 hi5: rock1986.hi5.com
Google: shamim.arafat@gmail.com youtube: rocksworld1986
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,876
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 11
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: output window for c++!!! help!!

  #6  
Feb 18th, 2008
I would not hire you if I saw that code.

Listen to VernonDozier and niek_e. They know what they are talking about.

Your program is a C program (not C++), so you shouldn't be using C++ stuff in it.
Reply With Quote  
Join Date: Sep 2008
Posts: 1
Reputation: SNOWKID is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
SNOWKID SNOWKID is offline Offline
Newbie Poster

Re: output window for c++!!! help!!

  #7  
22 Days Ago
Originally Posted by Duoas View Post
I would not hire you if I saw that code.

Listen to VernonDozier and niek_e. They know what they are talking about.

Your program is a C program (not C++), so you shouldn't be using C++ stuff in it.



Hey folks,

This discussion is a huge help for me as I am a new be into programming. I just started learning C, is it OK? Or is there any better way to start?

Thanks
Reply With Quote  
Join Date: Sep 2008
Posts: 6
Reputation: obj7777 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
obj7777 obj7777 is offline Offline
Newbie Poster

Re: output window for c++!!! help!!

  #8  
22 Days Ago
Originally Posted by SNOWKID View Post
Hey folks,

This discussion is a huge help for me as I am a new be into programming. I just started learning C, is it OK? Or is there any better way to start?

Thanks


Learning C is fine if that's what you want to learn. All he is saying is don't use the C++ iostream in your C program.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 10:45 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC