| | |
cin.getline
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
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...
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy desktop developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






