473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Question on implementation of 'cin'

Can't I accepet a sentence with cin, using array, without usung gets.
Sep 12 '07 #1
4 1883
gpraghuram
1,275 Expert 1GB
Can't I accepet a sentence with cin, using array, without usung gets.
Hi,
You can get a sentence without using cin, but the catch is the sentence shouldnt contain a space.
If it contains a space then it may read only the first word.

Raghuram
Sep 12 '07 #2
sicarie
4,677 Expert Mod 4TB
Hi,
You can get a sentence without using cin, but the catch is the sentence shouldnt contain a space.
If it contains a space then it may read only the first word.

Raghuram
If cin is mandatory, one option is to loop cin until you receive a sentinel or some signal (such as a period or a \n) that you have read the entire sentence, if cin isn't mandatory, you could use another input stream besides cin to capture the whole line.
Sep 12 '07 #3
arnaudk
424 256MB
By the way, does anybody know if it's possible to change the word delimiter of cin from a space to something else?
Sep 12 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
By the way, does anybody know if it's possible to change the word delimiter of cin from a space to something else?
This is not clear. For cin>>, the delimiter is a space.

If you use cin.getline(), you can fetch an entire string. The default delimiter is a \n but this can be changed to any character you want.
Sep 12 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Kevin Stern | last post by:
Hi All, Here is a program I wrote and compiled using g++ #include <iostream> int main() { char a; std::cin.get(a); std::cout << a; std::cin.ignore(100, '\n');
3
by: cppaddict | last post by:
Hi, When cin >> myVar is successful, the ">>" operator returns the cin object. But when it fails it returns 0, or false. My question is: Since a function can only return one type, how is...
11
by: kazack | last post by:
I am under the the impression that a variable is what is stored in a memory address and a pointer is the memory address of the variable? I was looking to use a function that does not return a...
9
by: R.Neeser | last post by:
Hello, how do i get an keyboard input from the consol, WITH THE Space char? scnaf and all the other function divide the input string on such a char and give every part to a different variable....
27
by: Jason Heyes | last post by:
To my understanding, std::vector does not use reference counting to avoid the overhead of copying and initialisation. Where can I get a reference counted implementation of std::vector? Thanks.
7
by: Alex Vinokur | last post by:
I tried to build program with partial implementation. However a linker generates errors. Is there any approach that enables to use partial implementation for similar purposes? ------ foo.cpp...
5
by: Hypnotik | last post by:
Hello everyone. I'm working on multiple inheritance program. I have a pretty specific problem that I'm not sure how to overcome. I'm going to try to explain this as simple as possible. There is a...
19
beacon
by: beacon | last post by:
As you can probably tell from the title, I'm a little frustrated with linked lists. I'm working on a homework assignment and it just isn't making sense to me. I've read and read and read on the...
4
by: subramanian100in | last post by:
In the book, C++ Coding Standards book by Hereb Sutter and Andrei Alexandrescu, in Item 40 on pages 86-87 viz, "Avoid providing implicit conversions", the authors have advised the use of named...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.