Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Nov 25th, 2004, 1:31 PM   #1
mswift
Newbie
 
Join Date: Nov 2004
Posts: 5
Rep Power: 0 mswift is on a distinguished road
Okay I am learning C++ using the book: Teach Yourself C++ third Edition.

I am trying to write a simple program, that asks the user for some text then, out puts that text as well as the count of characters used.

My program is using cin.get()
I need to use this so I can see the result of my program and make sure it is working correctly, but I can't seem to get cin.get() working. here is the code:

/*
A C++ program that uses I/O to prompt user for a striong and then display its length
*/

#include <iostream>
#include <string> // library that allows the use of cin.get(); (stops the program) I think
using namespace std;

int main()
{
char i;
double d;


cout << "Please enter some text.";

cin >> i;
cout << i;



cin.get();

return 0;

}
mswift is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:01 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC