login  Naam:   Wachtwoord: 
Registreer je!
 Forum

c++ output

Offline Simon - 30/07/2006 19:46
Avatar van SimonPHP expert
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7. int i;
  8. cout << "Please enter an integer value: ";
  9. cin >> i;
  10. cout << "The value you entered is " << i;
  11. cout << " and its double is " << i*2 << ".\n";
  12. cin.get();
  13. }

yoo sima-leden, ik ben begonnen met c++ en het lukt me aardig om wat basis stuff uit te werken
maar ik loop vast als ik dit execute, ik geef een nummer in en het schermpje sluit, nochtans probeer ik dit te voorkomen met cin.get();
bij andere scriptjes werkte dat perfect, maar hier niet; met of zonder is er geen verschil

Is er iemand die weet hoe ik kan voorkomen dat het (dos-)schermpje sluit?

4 antwoorden

Gesponsorde links
Offline MothZone - 30/07/2006 20:21
Avatar van MothZone PHP ver gevorderde opnieuw cin.get() doen

als je geen "cin >>" doet is 1x cin.get() genoeg, anders 2x
Offline Simon - 30/07/2006 20:31
Avatar van Simon PHP expert thx, het werkt 
Offline Voldemort - 30/07/2006 20:56
Avatar van Voldemort PHP ver gevorderde Gewoon aan het einde (van je main functie) doen:

return 0;

Dat werkt hier ook, je programma eindigt, maar de output blijft (hier onder Linux toch). Nu er toch een topic over C++ is:

ik heb geen windows.h bestand op Linux. Ik zocht en ik lijk er 1 te hebben in:

/usr/include/directfb-internal/core/

Dus zorg ik dat ie daar dat windows.h uithaalt, maar dan krijg ik (g++):

  1. g++ -I/usr/include/directfb-internal/core/ message
  2. box.cpp
  3. In file included from /usr/include/c++/4.0.2/backward/iostream.h:31,
  4. from messagebox.cpp:1:
  5. /usr/include/c++/4.0.2/backward/backward_warning.h:32:2: warning: #warning This
  6. file includes at least one deprecated or antiquated header. Please consider usin
  7. g one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples
  8. include substituting the <X> header for the <X.h> header for C++ includes, or <i
  9. ostream> instead of the deprecated header <iostream.h>. To disable this warning
  10. use -Wno-deprecated.
  11. In file included from messagebox.cpp:2:
  12. /usr/include/directfb-internal/core/windows.h:31:22: error: directfb.h: Onbekend
  13. bestand of map
  14. /usr/include/directfb-internal/core/windows.h:33:27: error: core/coredefs.h: Onb
  15. ekend bestand of map
  16. /usr/include/directfb-internal/core/windows.h:34:28: error: core/coretypes.h: On
  17. bekend bestand of map
  18. /usr/include/directfb-internal/core/windows.h:36:27: error: fusion/object.h: Onb
  19. ekend bestand of map
  20. /usr/include/directfb-internal/core/windows.h:76: error: ‘DFBRectangle’ does not
  21. name a type
  22. /usr/include/directfb-internal/core/windows.h:78: error: ‘DFBWindowStackingClass
  23. ’ does not name a type
  24. /usr/include/directfb-internal/core/windows.h:79: error: ‘DFBWindowOptions’ does
  25. not name a type
  26. /usr/include/directfb-internal/core/windows.h:80: error: ‘DFBWindowEventType’ do
  27. es not name a type
  28. /usr/include/directfb-internal/core/windows.h:81: error: ‘__u32’ does not name a
  29. type
  30. /usr/include/directfb-internal/core/windows.h:82: error: ‘DFBRegion’ does not na
  31. me a type
  32. /usr/include/directfb-internal/core/windows.h:96: error: expected constructor, d
  33. estructor, or type conversion before ‘*’ token
  34. /usr/include/directfb-internal/core/windows.h:101: error: expected constructor,
  35. destructor, or type conversion before ‘(’ token
  36. /usr/include/directfb-internal/core/windows.h:121: error: variable or field ‘dfb
  37. _window_destroy’ declared void
  38. /usr/include/directfb-internal/core/windows.h:121: error: ‘CoreWindow’ was not d
  39. eclared in this scope
  40. /usr/include/directfb-internal/core/windows.h:121: error: ‘window’ was not decla
  41. red in this scope
  42. /usr/include/directfb-internal/core/windows.h:126: error: ‘DFBResult’ does not n
  43. ame a type
  44. /usr/include/directfb-internal/core/windows.h:135: error: ‘DFBResult’ does not n
  45. ame a type
  46. /usr/include/directfb-internal/core/windows.h:143: error: ‘DFBResult’ does not n
  47. ame a type
  48. /usr/include/directfb-internal/core/windows.h:150: error: ‘DFBResult’ does not n
  49. ame a type
  50. /usr/include/directfb-internal/core/windows.h:156: error: ‘DFBResult’ does not n
  51. ame a type
  52. /usr/include/directfb-internal/core/windows.h:162: error: ‘DFBResult’ does not n
  53. ame a type
  54. /usr/include/directfb-internal/core/windows.h:168: error: ‘DFBResult’ does not n
  55. ame a type
  56. /usr/include/directfb-internal/core/windows.h:174: error: ‘DFBResult’ does not n
  57. ame a type
  58. /usr/include/directfb-internal/core/windows.h:181: error: ‘DFBResult’ does not n
  59. ame a type
  60. /usr/include/directfb-internal/core/windows.h:188: error: ‘DFBResult’ does not n
  61. ame a type
  62. /usr/include/directfb-internal/core/windows.h:195: error: ‘DFBResult’ does not n
  63. ame a type
  64. /usr/include/directfb-internal/core/windows.h:202: error: ‘DFBResult’ does not n
  65. ame a type
  66. /usr/include/directfb-internal/core/windows.h:210: error: ‘DFBResult’ does not n
  67. ame a type
  68. /usr/include/directfb-internal/core/windows.h:217: error: ‘DFBResult’ does not n
  69. ame a type
  70. /usr/include/directfb-internal/core/windows.h:225: error: ‘DFBResult’ does not n
  71. ame a type
  72. /usr/include/directfb-internal/core/windows.h:233: error: ‘DFBResult’ does not n
  73. ame a type
  74. /usr/include/directfb-internal/core/windows.h:236: error: ‘DFBResult’ does not n
  75. ame a type
  76. /usr/include/directfb-internal/core/windows.h:237: error: ‘DFBResult’ does not n
  77. ame a type
  78. /usr/include/directfb-internal/core/windows.h:238: error: ‘DFBResult’ does not n
  79. ame a type
  80. /usr/include/directfb-internal/core/windows.h:239: error: ‘DFBResult’ does not n
  81. ame a type
  82. /usr/include/directfb-internal/core/windows.h:240: error: ‘DFBResult’ does not n
  83. ame a type
  84. /usr/include/directfb-internal/core/windows.h:243: error: ‘DFBResult’ does not n
  85. ame a type
  86. /usr/include/directfb-internal/core/windows.h:247: error: variable or field ‘dfb _window_post_event’ declared void
  87. /usr/include/directfb-internal/core/windows.h:247: error: ‘CoreWindow’ was not d eclared in this scope
  88. /usr/include/directfb-internal/core/windows.h:247: error: ‘window’ was not decla red in this scope
  89. /usr/include/directfb-internal/core/windows.h:247: error: ‘DFBWindowEvent’ was n ot declared in this scope
  90. /usr/include/directfb-internal/core/windows.h:247: error: ‘event’ was not declar ed in this scope
  91. /usr/include/directfb-internal/core/windows.h:247: error: initializer expression list treated as compound expression
  92. /usr/include/directfb-internal/core/windows.h:249: error: ‘DFBResult’ does not n ame a type
  93. /usr/include/directfb-internal/core/windows.h:251: error: ‘DFBWindowID’ does not name a type
  94. /usr/include/directfb-internal/core/windows.h:253: error: expected constructor, destructor, or type conversion before ‘*’ token
  95. messagebox.cpp: In function ‘int main():
  96. messagebox.cpp:9: error: ‘MB_YESNO’ was not declared in this scope
  97. messagebox.cpp:9: error: ‘MessageBox’ was not declared in this scope
  98. messagebox.cpp:11: error: ‘IDYES’ was not declared in this scope
Offline Simon - 30/07/2006 21:07
Avatar van Simon PHP expert @voldemort, ik ken geen oplossing voor jouw probleem, maar euh return 0; dat gaat niet, dat was het eerste dat ik probeerde, dat mislukt ook; wss door windows 
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.208s