cin.getline

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2004
Posts: 11
Reputation: MaxC is an unknown quantity at this point 
Solved Threads: 0
MaxC MaxC is offline Offline
Newbie Poster

cin.getline

 
0
  #1
Jun 17th, 2004
Hello all,

what do you think the answer following question is?



The cin.getline function:

a) reads a fixed number of characters as a string into a character array.

b) reads a line as a string into a character array.

c) reads a string up to the first blank space.

d) reads a character into an array

Answer:
MSVC++
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,342
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 237
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: question

 
0
  #2
Jun 17th, 2004
Answer:
Use Google to find a reference.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 11
Reputation: MaxC is an unknown quantity at this point 
Solved Threads: 0
MaxC MaxC is offline Offline
Newbie Poster

Re: question

 
0
  #3
Jun 17th, 2004
Originally Posted by Dave Sinkula
Answer:
Use Google to find a reference.
I already had but still a bit confused about the questions.
Ok, I think the answer is a), but why not b)?
MSVC++
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 256
Reputation: FireNet will become famous soon enough FireNet will become famous soon enough 
Solved Threads: 6
FireNet's Avatar
FireNet FireNet is offline Offline
Posting Whiz in Training

Re: cin.getline

 
0
  #4
Jun 18th, 2004
Choice ( A ) is the most accurate.There are more funtions getline can peform.
See what you can, remember what you need

Fourzon | Earn via Coding
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 11
Reputation: MaxC is an unknown quantity at this point 
Solved Threads: 0
MaxC MaxC is offline Offline
Newbie Poster

Re: cin.getline

 
0
  #5
Jun 18th, 2004
I have another question if you dont mind me asking - (last one).

The arguments to the cin.getline function should be

a. format string and the buffer size.

b. character array and the array size.
If (b) was -array name and the array size- it would be accurate(?)
I think is (a) even if I dont quite understand why.

I dont write these questions.
Thanks for the replies...
MSVC++
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 34
Reputation: Fili is an unknown quantity at this point 
Solved Threads: 0
Fili's Avatar
Fili Fili is offline Offline
Light Poster

Re: cin.getline

 
0
  #6
Jun 18th, 2004
It should be answer (b)
Here's an example:
  1. #include <iostream.h>
  2. main()
  3. {
  4. char s[100];
  5. cin.getline(s,100);
  6. cout<<s;
  7. }
So, cin.getline(char_array,max_lenght_of_array); :lol:
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1
Reputation: azeembutt is an unknown quantity at this point 
Solved Threads: 0
azeembutt azeembutt is offline Offline
Newbie Poster

Re: cin.getline

 
0
  #7
Apr 22nd, 2005
Originally Posted by Fili
It should be answer (b)
Here's an example:
  1. #include <iostream.h>
  2. main()
  3. {
  4. char s[100];
  5. cin.getline(s,100);
  6. cout<<s;
  7. }
So, cin.getline(char_array,max_lenght_of_array); :lol:
Thanks.
You have solved my problem
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC