Click here to Skip to main content
15,902,938 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Please help !!!! Pin
Hamid_RT10-Aug-06 8:20
Hamid_RT10-Aug-06 8:20 
QuestionRe: Please help !!!! Pin
Bravoone_200610-Aug-06 19:47
Bravoone_200610-Aug-06 19:47 
QuestionMoving Ellipse Problem Pin
uday kiran janaswamy9-Aug-06 19:59
uday kiran janaswamy9-Aug-06 19:59 
AnswerRe: Moving Ellipse Problem Pin
_AnsHUMAN_ 9-Aug-06 20:20
_AnsHUMAN_ 9-Aug-06 20:20 
AnswerRe: Moving Ellipse Problem Pin
Hamid_RT9-Aug-06 21:22
Hamid_RT9-Aug-06 21:22 
QuestionCapturing key presses with WinProc Pin
Coremn9-Aug-06 19:42
Coremn9-Aug-06 19:42 
AnswerRe: Capturing key presses with WinProc Pin
sunit59-Aug-06 19:57
sunit59-Aug-06 19:57 
AnswerRe: Capturing key presses with WinProc Pin
ThatsAlok9-Aug-06 21:59
ThatsAlok9-Aug-06 21:59 
QuestionPort numbers Pin
Anu_Bala9-Aug-06 19:34
Anu_Bala9-Aug-06 19:34 
AnswerRe: Port numbers Pin
Divyang Mithaiwala9-Aug-06 19:42
Divyang Mithaiwala9-Aug-06 19:42 
Questiontiff file creation [modified] Pin
Kiran Pinjala9-Aug-06 19:26
Kiran Pinjala9-Aug-06 19:26 
Questionwhat am I doing wrong? [modified] Pin
freakinn00b9-Aug-06 19:21
freakinn00b9-Aug-06 19:21 
AnswerRe: what am I doing wrong? Pin
sunit59-Aug-06 19:28
sunit59-Aug-06 19:28 
AnswerRe: what am I doing wrong? Pin
_AnsHUMAN_ 9-Aug-06 19:28
_AnsHUMAN_ 9-Aug-06 19:28 
AnswerRe: what am I doing wrong? Pin
ThatsAlok9-Aug-06 22:21
ThatsAlok9-Aug-06 22:21 
GeneralRe: what am I doing wrong? Pin
freakinn00b9-Aug-06 19:38
freakinn00b9-Aug-06 19:38 
GeneralRe: what am I doing wrong? Pin
sunit59-Aug-06 19:41
sunit59-Aug-06 19:41 
GeneralRe: what am I doing wrong? Pin
sunit59-Aug-06 19:46
sunit59-Aug-06 19:46 
GeneralRe: what am I doing wrong? Pin
_AnsHUMAN_ 9-Aug-06 19:51
_AnsHUMAN_ 9-Aug-06 19:51 
GeneralRe: what am I doing wrong? Pin
ThatsAlok9-Aug-06 22:24
ThatsAlok9-Aug-06 22:24 
GeneralRe: what am I doing wrong? Pin
Hamid_RT9-Aug-06 22:44
Hamid_RT9-Aug-06 22:44 
GeneralRe: what am I doing wrong? Pin
David Crow10-Aug-06 3:32
David Crow10-Aug-06 3:32 
AnswerRe: what am I doing wrong? Pin
Zac Howland10-Aug-06 4:30
Zac Howland10-Aug-06 4:30 
While I realize you said you were doing this for educational purposes, it is also worth noting that you should also learn to reuse code that has already been written and well tested. Your code could simplify to the following:

#include <iostream>
using namespace std;

int main()
{
	// declare string storage
	string theStr = "";

	// get string input of unknown length
	char ch = '\0';
	while (ch != '\n')
	{
		ch = cin.get();
		theStr += ch;
	}

	// print length information
	cout << "You entered a string with length:  "
	     << theStr.length() << endl;
	return 0;
}


Don't get into the habit of reinventing the wheel. There are a lot of buggy programs out there because of developers doing just that without realizing they could have written much less code to accomplish the very same thing.

If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac

AnswerRe: what am I doing wrong? Pin
freakinn00b11-Aug-06 5:30
freakinn00b11-Aug-06 5:30 
Questionvariable type [modified] Pin
With_problem9-Aug-06 19:18
With_problem9-Aug-06 19:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.