gocho Posted January 9, 2007 at 12:29 AM Report #75313 Posted January 9, 2007 at 12:29 AM Boas! Existe alguma função que transforme um int em string no c++? Já estive por ai a procurar mas não consigo encontrar nada. A unica que encontrei, é a itoa(), mas não dá o resulatado pretendido.. Cumprimentos
Hipnoted Posted January 9, 2007 at 12:36 AM Report #75317 Posted January 9, 2007 at 12:36 AM Em C o sprintf dá na boa. Em C++ também deve dar. 😞 "Nunca discutas com um idiota. Eles arrastam-te até ao seu nível e depois ganham-te em experiência"
Triton Posted January 9, 2007 at 12:44 AM Report #75322 Posted January 9, 2007 at 12:44 AM Exemplo de código: char result[100]; int num=24; sprintf( result, "%d", num ); <3 life
Rui Carlos Posted January 9, 2007 at 10:41 AM Report #75352 Posted January 9, 2007 at 10:41 AM podes usar o sprintf, mas uma vez que estamos em C++ devias usar streams. algo como isto deve funcionar. #include <string> #include <sstream> ... int i = 8; stringstream ss; ss << i; string s = ss.str(); ... PS: já moviam o tópico para a secção correcta... Rui Carlos Gonçalves
Gamas Posted January 16, 2007 at 06:32 PM Report #76625 Posted January 16, 2007 at 06:32 PM Boas estou a começar a aprender C++ e tou aqui com uma duvida no VC++: o que queria é no click duma picture box adicionar um valor a uma variável e depois converter essa variável(int) em string para poder meter o seu valor numa Label. tenho isto: #include <string> #include <sstream> private: System::Void Pb1_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { int num; num = num + 10; this->Lbl1->Text = num;
Gamas Posted January 18, 2007 at 09:33 AM Report #77047 Posted January 18, 2007 at 09:33 AM someone help me please!!
natros Posted January 25, 2007 at 08:16 PM Report #78601 Posted January 25, 2007 at 08:16 PM someone help me please!! isto n é c++, é c++/cli
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now