We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Get An Un-Known Ammout Of Imput

I'm trying to write an echo like thing doing this
:

> echo Muffins
Muffinst
> echo two muffins
two muffins

The problem Is that the program isn't being started from command line,
The > is my programs input prompt (trying to write a very simple command line)
How would I do this?
Would it be possible with formatted input (cin>>)?
or would I have to use scanf?

2
Contributors
3
Replies
10 Hours
Discussion Span
1 Year Ago
Last Updated
4
Views
Zssffssz
Junior Poster
180 posts since Sep 2011
Reputation Points: 6
Solved Threads: 2
Skill Endorsements: 0

Use getline()

WaltP
Posting Sage w/ dash of thyme
Team Colleague
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37

How wOuld I separate echo from the rest of the string (seperatre not remove I still need to see what the person is doing)?

Zssffssz
Junior Poster
180 posts since Sep 2011
Reputation Points: 6
Solved Threads: 2
Skill Endorsements: 0

Write a couple test programs to understand how input works.

1) use cin in a loop to read and display what is read
2) use getline() in a loop to read and display what is read
3) same with other input commands you know

WaltP
Posting Sage w/ dash of thyme
Team Colleague
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.3106 seconds using 2.69MB