I am working on a lab for statement problem and i can't figure out how to start it. Make a program that will input the 10 numbers and determine their average and display all numbers that are smaller than the average.
sample possible output:
Enter number : 1
2
3
4
5
6
7
8
9
15
average is: 6
numbers smaller than the average: 1
2
3
4
5
That's why putting using namespace std; before using cout allows you to just use cout.
Otherwise you can specify the namespace it's in like std::cout.
I do that to avoid name collisions (good practice too) and many others do too.
1 2 3 4 5 6 7 8 9
#include <iostream>
// Global
usingnamespace std;
int main()
{
// using namespace std; can be put main function (local)
cout << "Hello World!";
return 0;
}
1 2 3 4 5 6 7
#include <iostream>
int main()
{
// Specifying which namespace cout is in
std::cout << "Hello World";
return 0;
}
@keskiverto
Do you prefer MinGW or TDM - GCC?
I haven't got MinGW to work since whenever I invoke g++ via command line it only works if I'm in MinGW folder where the compiler is.
@ keskiverto
yes ! i know Turbo C++ is old but our school still using since they are only teaching us the basics and fundamentals of c++ programming. I'm only a second year computer engineering student