Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   The easiest question for YOU.. :( (http://www.programmingforums.org/showthread.php?t=8594)

boraciner Feb 26th, 2006 8:48 AM

The easiest question for YOU.. :(
 
I couldn't get "hi world" from the user in C++ .Net

I know how to get in C with using gets() function , but I couldn't do this in Microsoft Visual Studio .NET 2003 ( c++ ) ..
please help me ... I wanna get a sentence from the user .. and print it on the screen..

Thanks.

Jessehk Feb 26th, 2006 9:23 AM

:


#include <iostream>
#include <string>

int main() {
    std::string input;

    std::cout << "Enter some text: ";
    std::getline(std::cin, input);

    std::cout << "You entered \"" << input << "\"." << std::endl;
   
    return 0;
}


boraciner Feb 26th, 2006 9:52 AM

thanx a lot..

Polyphemus_ Feb 26th, 2006 10:24 AM

That is basic stuff. I recommend reading a good tutorial teaching you the basics of the C++ language.


All times are GMT -5. The time now is 9:29 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC