السلام عليكم
اريد طباعة متغير من نوع int بواسطة دالة MessageBox
مثلاً :
int i=10; MessageBox( i );
السلام عليكم
اريد طباعة متغير من نوع int بواسطة دالة MessageBox
مثلاً :
int i=10; MessageBox( i );
http://www.cplusplus.com/reference/clibrar...tdlib/itoa.html
http://notfaq.wordpress.com/2006/08/30/c-c...-int-to-string/
تم تعديل هذه المشاركة بواسطة NullFlag في 17 مايو 2007 في 21:10
الطريقة هذه ما تنفع لان ال MFC لايوجد فيها سوى CString على ما اظن :
#include <sstream>
int i = 5;
string str;
stringstream out;
out << i;
str = out.str();
والطريقة الثانية ما عرفت كيفية استخدامها ؟
#include <fstream>
#include <sstream>
#include <iostream>
using namespace std;
int main()
{
stringstream s;
int a=5;
s<<a;
MessageBox(s.str().c_str());
}تم تعديل هذه المشاركة بواسطة NullFlag في 18 مايو 2007 في 02:46
int i=10;
CString s;
s.Format("%i",i);
MessageBox( s );شكر اخي نيزك
هناك مشكلة عندما أقوم بعمل الكود التالي :
CString s2;
s2.Format("%count", count);
//s1+=s2;
MessageBox( s2 , "Singly Linked List", MB_ICONINFORMATION );يظهر []ount بدلا من الرقم !!
مجلـد جديـد كتب:هناك مشكلة عندما أقوم بعمل الكود التالي :CString s2; s2.Format("%count", count); //s1+=s2; MessageBox( s2 , "Singly Linked List", MB_ICONINFORMATION );يظهر []ount بدلا من الرقم !!
s2.Format("%i", count);لا إله إلا الله محمد رسول الله
busbar : يجب ان تدرك انه هناك حد ادنى للمعرفة المطلوبة قبل البدء في عمل أي شئ.
شكرا لك ، الان تشتغل 100%
لكن عندما قوم بتطبيق هذا الكود :
void CSinglyLinkedListintDlg::OnPrint()
{
// TODO: Add your control notification handler code here
Node* currentPtr = firstPtr;
CString contents("");
if ( currentPtr != NULL )
{
while( currentPtr -> next != NULL )
{
CString temp("");
temp.Format("%i", currentPtr->DATA );
contents += temp;
contents += " -> ";
currentPtr = currentPtr->next;
}
contents =+ currentPtr -> DATA;
printDLG.m_content = contents;
printDLG.DoModal();
}
else
MessageBox("The list is empty" );
}تظهر لي حروف عربية !!
الكود يقوم بالتالي : اذا كان عندك linked list وفيها خمس عناصر : 15 ، 13 ، 1 ، 7 ، 3
فالمفروض ان CString contetns تكون تحتوي على النص التالي :
15 -> 13 -> 1 -> 7 -> 3
تم تعديل هذه المشاركة بواسطة مجلـد جديـد في 20 مايو 2007 في 15:29
هذا الموضوع مغلق.