Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. Próba kompilacji błędnego programu:
  2.  
  3. ```
  4. int main() {
  5. int x = "";
  6. return x;
  7. }
  8. ```
  9.  
  10. kończy się komunikatem:
  11.  
  12. ```
  13. TODO Expected type int (Line: 2)
  14. ```
  15.  
  16. To "TODO" jest trochę niepokojące.
  17.  
  18. Jeśli chce Pan odzyskać stracone punkty, proszę usunąć, w ciągu najbliższego
  19. tygodnia, poniższe błędy.
  20.  
  21. Próba kompilacji programu:
  22.  
  23. ```
  24. int main() {
  25. if (0 == 0 == true) {
  26. printString("Tak");
  27. }
  28. return 0;
  29. }
  30. ```
  31.  
  32. kończy się komunikatem:
  33.  
  34. ```
  35. d.s:33: error: invalid combination of opcode and operands
  36. ```
  37.  
  38. Wynikiem programu:
  39.  
  40. ```
  41. int p(int x, int y) {
  42. return x + y;
  43. }
  44.  
  45. int main() {
  46. printInt(p(2, p(1, 1)));
  47. return 0;
  48. }
  49. ```
  50.  
  51. jest 3, a powinno być 4.
  52.  
  53. Program:
  54.  
  55. ```
  56. int main(int x) {
  57. return 0;
  58. }
  59. ```
  60.  
  61. kompiluje się, choć nie powinien.
  62.  
  63. Próba kompilacji programu:
  64.  
  65. ```
  66. int main() {
  67. boolean b = true;
  68. if (b) {
  69. printString("Tak");
  70. } else {
  71. printString("Nie");
  72. }
  73. if (b) {
  74. printString("Tak");
  75. } else {
  76. printString("Nie");
  77. }
  78. return 0;
  79. }
  80. ```
  81.  
  82. kończy się błędem:
  83.  
  84. ```
  85. d.s:17: error: symbol `_str2′redefinedd.s:18:error:symbol‘str3' redefined
  86. ```
  87.  
  88. Wynikiem programu:
  89.  
  90. ```
  91. int main() {
  92. printInt(((1 + 1) + (1 + 1)) + ((1 + 1) + (1 + 1)));
  93. return 0;
  94. }
  95. ```
  96.  
  97. jest 6, a powinno być 8.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement