| | |
cin.getline
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: May 2004
Posts: 11
Reputation:
Solved Threads: 0
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:
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++
"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
•
•
Join Date: May 2004
Posts: 11
Reputation:
Solved Threads: 0
I have another question if you dont mind me asking - (last one).
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...
•
•
•
•
The arguments to the cin.getline function should be
a. format string and the buffer size.
b. character array and the array size.![]()
I think is (a) even if I dont quite understand why.
I dont write these questions.
Thanks for the replies...
MSVC++
It should be answer (b)
Here's an example:
So, cin.getline(char_array,max_lenght_of_array); :lol:
Here's an example:
C++ Syntax (Toggle Plain Text)
#include <iostream.h> main() { char s[100]; cin.getline(s,100); cout<<s; }
•
•
Join Date: Apr 2005
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Fili
It should be answer (b)
Here's an example:
So, cin.getline(char_array,max_lenght_of_array); :lol:C++ Syntax (Toggle Plain Text)
#include <iostream.h> main() { char s[100]; cin.getline(s,100); cout<<s; }
You have solved my problem
![]() |
Similar Threads
- cin.getline problem (C++)
- need help problem with cin.getline method (C++)
- need help problem with cin.getline method (C++)
Other Threads in the C++ Forum
- Previous Thread: run code
- Next Thread: Please help with what '*' and '&' mean...
Views: 16880 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays based beginner binary c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort sorting spoonfeeding string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






