הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   [C++] צריך עזרה במשהו. (https://hosts.co.il/forums/showthread.php?t=30375)

Elad-A 06-09-06 20:39

[C++] צריך עזרה במשהו.
 
שלום,

אני משתמש בקומפיילר של Dev-C++ וכשאני מנסה את הדוגמאות שיש בכתובת הבאה :

http://vlib.eitan.ac.il/cplusplus2/guide2-1.html

זה תמיד מחזיר שגיאות. ואני פותח בתור C++ ולא C ככה שזה לא הבעיה.

סתם לדוגמא ניסיתי להריץ את הקןד הבא:

קוד:


#include <iostream.h>


int main()
{
  cout<<"HEY, you, I'm alive!  Oh, and Hello World!";
  return 0;   
}

זה מחזיר:

קוד:

1 C:\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31,              from C:\Documents and Settings\Elad-A\Desktop\New Folder\Untitled1.cpp In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31,              from C:\Documents and Settings\Elad-A\Desktop\New Folder\Untitled1.cpp
1 C:\Documents and Settings\Elad-A\Desktop\New Folder\Untitled1.cpp                  from C:\Documents and Settings\Elad-A\Desktop\New Folder\Untitled1.cpp
32:2 C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.

חח מקוד כל כך קטן זה מה שיוצא..

אז מה הבעיה בקומפיילר או בקודים?

בניה 06-09-06 20:59

ב"ה


זו לא שגיאה זו רק הערה.
תנסה להריץ את התוכנית.

Elad-A 06-09-06 21:05

ניסיתי עוד משהו:

קוד:


#include <iostream.h>

int main()
{
  char string[256];  //A nice long string
  cout<<"Please enter a long string: ";
  cin.getline(string, 256, '\n'); //The user input goes into string
  cout<<"Your long string was:"<<endl<<string;
  return 0;
}

אני מצליח להריץ. אבל... אחרי שאני מכניס מספר זה אמור להציג משהו אבל ישר שאני רושם משהו זה יוצא.

Balrog 07-09-06 14:41

תוסיף בסוף הקוד איזה שורה שמחכה לקלט, או שתריץ את הקובץ דרך הCMD, כנראה שלא כל הקומפיילרים מחכים בסוף ההרצה.


כל הזמנים הם GMT +2. הזמן כעת הוא 20:34.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ