Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
cin>>
- Page 1
Re: how to create a simple elevator simulation?
Programming
Software Development
2 Days Ago
by trueframe
To make a basic elevator simulation, first, identify the floors and the elevator's capacity. Then, use loops and conditionals in programming to mimic its movement. Include buttons for users to call the elevator and select floors. Test thoroughly for accuracy.
Re: Cin Help
Programming
Software Development
11 Years Ago
by VernonDozier
cin
.get() gets one character, not a string. Perhaps you want … imagine you'd be better off using the regular old &
gt
;&
gt
; operator with
cin
.
cin
&
gt
;&
gt
; firstword;
cin
&
gt
;&
gt
; secondword;
Re: cin.get problems in use
Programming
Software Development
18 Years Ago
by Narue
cin
.get only gets one character. If there are more than … a direct call to get: [code] #include <limits.h&
gt
; void pause ( const char *msg = "" ) { cout<<…; msg;
cin
.ignore ( INT_MAX, '\n' );
cin
.get(); } [/code] Of course, that's hackish compared to…
Re: Cin question
Programming
Software Development
13 Years Ago
by mike_2000_17
…minimize the terminal window and maximize again, this could trigger
cin
to flush the few letters you had typed before and… OS-specific stuff or a GUI platform of some kind.
Cin
is meant for command-line instructions: basically, "type …a command and press <enter&
gt
;". BTW cout is independent from
cin
so waiting for a char or string…
Re: Cin Keyboard inpout to const char*
Programming
Software Development
14 Years Ago
by Salem
&
gt
;
Cin
Keyboard inpout to const char* You want to "INPUT&… it? Lesson number 1 [code] #include <iostream&
gt
; #include <string.h&
gt
; #include "holding.h" #include <stdio….h&
gt
; [/code] Decide whether you're a C programmer or a …
Re: cin.getline not working in for loop or...?
Programming
Software Development
18 Years Ago
by Narue
… input treats whitespace differently than nonformatted input. More precisely,
cin
's &
gt
;&
gt
; operator leaves a newline character in the stream for getline…
Re: cin.getline not working in for loop or...?
Programming
Software Development
18 Years Ago
by Narue
&
gt
;
cin
.ignore( 2, '\n'); Feel free to replace 2 with any arbitrary number. Someone invariably pipes in with something like this, but fails to do it properly. Once again, search the forum for a better solution.
Re: Cin question
Programming
Software Development
13 Years Ago
by Ancient Dragon
&
gt
;&
gt
;
cin
is a buffer, it needs to flush, just like cout No it is not a buffer -- it is a c++ class. And
cin
can not be flushed. flush() only works on output streams, never input streams.
Re: Cin Fail Method
Programming
Software Development
11 Years Ago
by Ancient Dragon
cin
.fail is not used to keep the screen open -- it is used to simply test to find out if
cin
succeeded or not. If you want to keep the screen open call
cin
.get().
Re: cin input
Programming
Software Development
11 Years Ago
by Lucaci Andrew
`
cin
` waits till the user inserts something into the stream, and after that it takes into consideration the `'\n'`
Re: cin.ignore
Programming
Software Development
15 Years Ago
by tymk
cin
.ignore(this post);
Re: cin.ignore
Programming
Software Development
15 Years Ago
by Ancient Dragon
cin
.ignore() does not affect any of the characters in the …
Re: cin a two word name
Programming
Software Development
11 Years Ago
by Moschops
cin
&
gt
;&
gt
; nameone &
gt
;&
gt
; nametwo;
Re: Homework Help, please... [cout, cin]
Programming
Software Development
19 Years Ago
by Dave Sinkula
cin
and cout are part of the standard namespace. Early on, …]using namespace std; // after the #includes[/code]Since you[code]
cin
&
gt
;&
gt
; base_cost; [/code]you shouldn't make it [FONT=Courier New…
Re: c++ (cin>>) error
Programming
Software Development
10 Years Ago
by Nutster
`
cin
&
gt
;&
gt
;answerBoss;` is reading an integer. When it gets to the … stream. To get around this, call `
cin
.ignore();` before each call to `
cin
&
gt
;&
gt
;`. This will tell `
cin
` to empty the line of input…
Re: Problem with "getline(cin, name)"
Programming
Software Development
16 Years Ago
by Narue
&
gt
;
cin
.get(sex); This only reads one of the two characters …
Re: Can "cin" be smarter?
Programming
Software Development
15 Years Ago
by stilllearning
cin
as you know will read your input variables separated by spaces. There no way to get
cin
to do what you want. You can use getline or you can overload the istream operator and write your own function to parse the input.
Re: c++ (cin>>) error
Programming
Software Development
10 Years Ago
by TheApex
**
cin
&
gt
;&
gt
;overTime;** won't get executed if you enter bad values for **
cin
&
gt
;&
gt
;answerBoss;** In your code, the input data is expected to be an integer, if you supply anything else, it won't run the 2nd **
cin
**.
Re: Why is my cin.getline getting skipped?
Programming
Software Development
13 Years Ago
by gmfreak1991
cin
.ignore( numeric_limits <streamsize&
gt
; ::max(), '\n' ); fixed it. thanks!
Re: problem with gets() and cin.getline() in linux
Programming
Software Development
15 Years Ago
by vmanes
cin
.getline( colour, 10 );
Re: Please sugget how can i make these source code more effecient. Thanks alot.
Programming
Software Development
9 Years Ago
by deceptikon
&
gt
;
cin
.sync(); // 'flush'
cin
stream ... Sadly, [it's not that easy](https://www.daniweb.…
Re: Bit of weirdness
Programming
Software Development
11 Years Ago
by mike_2000_17
… is placed on the buffer (internal to
cin
). When your program executes a line like `
cin
&
gt
;&
gt
; userInput`, the data is inspected (starting… << "Please enter a number\n"; while( !(
cin
&
gt
;&
gt
; userInput) ) { cout << "BAAAAAD USER! I SAID NUMBER…
Re: Linked List: Mp3 Menu (String and Delete problem)
Programming
Software Development
15 Years Ago
by james_zheng
cin
.getline() needs char* as its arguments, so you have to declare an char array to store the data. Then pass the length of the string you input. sample code: char str[100];
cin
.getline(str,100);
Re: separating strings in a structure
Programming
Software Development
12 Years Ago
by Ancient Dragon
cin
stops reading keyboard input at the first space or the enter key. The next time
cin
is called it will just take whatever is already in the keybord buffer, if anything. call getline() instead of
cin
to allow for spaces in the string. [icode]getline(
cin
,record[i].Sno);[/icode]
Re: problem in character type input
Programming
Software Development
13 Years Ago
by Ancient Dragon
cin
.ignore() is not needed after calling getline() -- delete them
Re: string input not working as expected
Programming
Software Development
18 Years Ago
by Narue
… whitespace as a delimiter: [code] string s;
cin
&
gt
;&
gt
; s; // Type "John Doe" cout<<…, defined in <limits&
gt
;: [code]
cin
.ignore(numeric_limits<streamsize&
gt
;::max(), '\n'); [/code] &
gt
;What am I to do… use whitespace as a separater, use operator&
gt
;&
gt
;. Otherwise use getline. &
gt
;you might be able to put "…
Re: while loop and getline
Programming
Software Development
15 Years Ago
by QuantNeeds
&
gt
; &
gt
; `
cin
&
gt
;&
gt
; setw( 20 ) &
gt
;&
gt
; toolName;` &
gt
; &
gt
; setw() is only for output streams, it does nothing on input streams such as
cin
. &
gt
; &
gt
; 1) …quantity in stock: ";
cin
&
gt
;&
gt
; inStock; cout << "Enter the unit price: ";
cin
&
gt
;&
gt
; unitPrice; // set the …
Re: Handling Exceptions - Program ignoring specific characters for if statements
Programming
Software Development
15 Years Ago
by Ancient Dragon
… be entered into numeric fields. So when you have [icode]
cin
&
gt
;&
gt
; num1[/icode] num1 will NEVER have 'x' or 'X'. What… denominator for each fraction. ";
cin
&
gt
;&
gt
; input1 &
gt
;&
gt
; input2; if( input1.length() &
gt
; 0 && input2.length() &
gt
; 0) { if( input1[0] == 'X…
Re: HELPP!!!!!!!!
Programming
Software Development
13 Years Ago
by Ancient Dragon
… to enter a number followed by the return key. &
gt
;&
gt
;if(
cin
.get()&
gt
;&
gt
;1); That line makes no sense. If you look…(answer); // or you can do it like this:
cin
&
gt
;&
gt
; answer; } [/code] And watch out for those semicolons at the …
Re: classes and arrays
Programming
Software Development
11 Years Ago
by WaltP
&
gt
;
cin
&
gt
;&
gt
; studentList[row].getSSN(); I don't see any definition at all for `getSSN()`. I suspect that's problem 1. Problem 2 is probably because `getSSN()` *returns* a value (as suggested by the name) and you are trying to read *into* it.
1
2
3
17
Next
Last
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Meet People
Forums
Top Members
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC