fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. int main()
  5. {
  6. int i, j, k;
  7. float x, y, z;
  8.  
  9. i = 10;
  10. j = 12;
  11. k = i * j;
  12. x = 1.25;
  13. y = 0.5;
  14. z = x * y;
  15. if (i % 2 == 0)
  16. cout << "genap";
  17. else
  18. cout << "ganjil";
  19. float result = i * j*j;
  20. cout << "hasilnya: " << result <<" k = "<<k<<;
  21. }
Compilation error #stdin compilation error #stdout 0.01s 5300KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:16:3: error: ‘cout’ was not declared in this scope
   cout << "genap";
   ^~~~
prog.cpp:16:3: note: suggested alternative:
In file included from prog.cpp:1:
/usr/include/c++/8/iostream:61:18: note:   ‘std::cout’
   extern ostream cout;  /// Linked to standard output
                  ^~~~
prog.cpp:18:3: error: ‘cout’ was not declared in this scope
   cout << "ganjil";
   ^~~~
prog.cpp:18:3: note: suggested alternative:
In file included from prog.cpp:1:
/usr/include/c++/8/iostream:61:18: note:   ‘std::cout’
   extern ostream cout;  /// Linked to standard output
                  ^~~~
prog.cpp:20:1: error: ‘cout’ was not declared in this scope
 cout << "hasilnya: " << result <<"   k = "<<k<<;
 ^~~~
prog.cpp:20:1: note: suggested alternative:
In file included from prog.cpp:1:
/usr/include/c++/8/iostream:61:18: note:   ‘std::cout’
   extern ostream cout;  /// Linked to standard output
                  ^~~~
prog.cpp:20:48: error: expected primary-expression before ‘;’ token
 cout << "hasilnya: " << result <<"   k = "<<k<<;
                                                ^
stdout
Standard output is empty