fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. #include <iostream> // Chapter 1 - includes cout, cin, endl, and other basic functions
  13. #include <cmath> // Chapter 2 - includes advanced math functions (exponential, trig, etc)
  14. #include <cstdlib> // Contains functions for absolute values and random numbers
  15. #include <iomanip> // Chapter 2 - includes "manipulators" (ex. setprecision)
  16. #include <string> // Chapter 2 - includes functions for strings
  17. #include <fstream> // Chapter 8 - includes functions for streaming I/O data
  18. using namespace std;
  19.  
  20. int main()
  21. {
  22. string a;
  23. string b;
  24. string c;
  25. cout << "Enter a word: ";//This asks for the first word.
  26. cin >> a;
  27. cout << "Enter a second word: ";// This asks for a second word.
  28. cin >> b;
  29. cout << "Enter a third word: ";// This asks for a third word.
  30. cin >> c;
  31. if (a < b)
  32. {
  33. if (b < c)
  34. {
  35. cout << "The alphabetical order is " << endl;
  36. cout << a << endl << b << endl << c << endl;
  37. }
  38. else
  39. {
  40. if (a < c)
  41. {
  42. cout << "The alphabetical order is " << endl;
  43. cout << a << endl << c << endl << b << endl;
  44. }
  45. else
  46. {
  47. cout << "The alphabetical order is " << endl;
  48. cout << c << endl << a << endl << b << endl;
  49. }
  50. }
  51. }
  52. else
  53. {
  54. if (b < c)
  55. {
  56. cout << "The alphabetical order is " << endl;
  57. cout << b << endl << a << endl << c <<endl;
  58. }
  59. else
  60. {
  61. if (a < c)
  62. {
  63. cout << "The alphabetical order is " << endl;
  64. cout << b << endl << c << endl << a << endl;
  65. }
  66. else
  67. {
  68. cout << "The alphabetical order is " << endl;
  69. cout << c << endl << b << endl << a << endl;
  70. }
  71. }
  72. }
  73.  
  74. system("pause");
  75. return 0;
  76. }
  77.  
  78.  
  79. }
  80. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:1: error: ‘import’ does not name a type
 import java.util.*;
 ^
prog.cpp:4:1: error: ‘import’ does not name a type
 import java.lang.*;
 ^
prog.cpp:5:1: error: ‘import’ does not name a type
 import java.io.*;
 ^
prog.cpp:10:9: error: expected ‘:’ before ‘static’
  public static void main (String[] args) throws java.lang.Exception
         ^
prog.cpp:10:27: error: ‘String’ has not been declared
  public static void main (String[] args) throws java.lang.Exception
                           ^
prog.cpp:10:36: error: expected ‘,’ or ‘...’ before ‘args’
  public static void main (String[] args) throws java.lang.Exception
                                    ^
prog.cpp:10:40: error: expected ‘;’ at end of member declaration
  public static void main (String[] args) throws java.lang.Exception
                                        ^
prog.cpp:10:42: error: ‘throws’ does not name a type
  public static void main (String[] args) throws java.lang.Exception
                                          ^
In file included from /usr/include/c++/4.8/ios:39:0,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from prog.cpp:12:
/usr/include/c++/4.8/exception:35:37: error: expected ‘}’ before end of line
 #pragma GCC visibility push(default)
                                     ^
/usr/include/c++/4.8/exception:35:37: error: expected unqualified-id before end of line
/usr/include/c++/4.8/exception:35:37: error: expected declaration before end of line
stdout
Standard output is empty