my problem is that how can we intialize a string using cin in output console like this.
eg.
My class is very good through cin...as the spaces put the null character so only first alphabet is initialized....kindly someone give me solution..
Builder_1 -6 Junior Poster in Training
Recommended Answers
Jump to Post@Builder , little bit of google search would do It
std:string is a part of string library (#include <string>)
Jump to PostHere is a more complete and compilable program snippet
#include <string> #include <iostream> int main(int arc, char* argv[]) { std::string input; if( argc > 1) input = argv[1]; // get string from command-line argument else std::cin >> input; // get string from keyboard or from stdin } …
Jump to PostVB Users, always include "stdafx.h"
Why?? It's only necessary if you use Visual C++ and then only if you use precompiled headers option. Otherwise you can delete it.
All 9 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Builder_1 -6 Junior Poster in Training
Builder_1 -6 Junior Poster in Training
Builder_1 -6 Junior Poster in Training
Builder_1 -6 Junior Poster in Training

ArashVenus
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
meta.quota 14 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.