G
Grumble
Hello,
I was recently told that there were <quote>a lot of things
wrong</quote> with the following program:
#include <iostream>
int main()
{
cout << '\a';
return 0;
}
I believe I should have written std::cout instead of cout.
Alternatively, I think I could have written:
using namespace std; // I can now write 'cout' and 'endl'
Second, I might need to write a newline to cout, otherwise the input
might be discarded, is that correct?
I'll make these two adjustments:
#include <iostream>
int main()
{
std::cout << '\a' << std::endl;
return 0;
}
Do you see anything wrong with this program as far as standard C++
is concerned? Did I really need to write endl to cout?
g++ -ansi -pedantic -Wall -W foo.cxx does not give any warning, but
I don't know how closely g++ adheres to the standard.
I was recently told that there were <quote>a lot of things
wrong</quote> with the following program:
#include <iostream>
int main()
{
cout << '\a';
return 0;
}
I believe I should have written std::cout instead of cout.
Alternatively, I think I could have written:
using namespace std; // I can now write 'cout' and 'endl'
Second, I might need to write a newline to cout, otherwise the input
might be discarded, is that correct?
I'll make these two adjustments:
#include <iostream>
int main()
{
std::cout << '\a' << std::endl;
return 0;
}
Do you see anything wrong with this program as far as standard C++
is concerned? Did I really need to write endl to cout?
g++ -ansi -pedantic -Wall -W foo.cxx does not give any warning, but
I don't know how closely g++ adheres to the standard.