>Can someone first please explain why std:: is everywhere in this book.
Because everything in the standard library is contained in the std namespace. Your book uses one of three ways to get access to the names in the namespace.
>I have never seen this before in C programming at all
Get used to it. Modern C++ is wildly different than C.
>Can experienced C++ programmers please help me.
If your compiler supports it (which it should), use namespaces. They are an excellent way to avoid naming conflicts, but for smaller programs can be annoying. There are three ways to gain access to a namespace:
Code:
#include <iostream>
using namespace std; // "Gimme everything"
int main()
{
cout<<"Hello, world!"<<endl;
}
Code:
#include <iostream>
// "Only give me what I need, but still let me use simple syntax"
using std::cout;
using std::endl;
int main()
{
cout<<"Hello, world!"<<endl;
}
Code:
#include <iostream>
// "I'll explicitly qualify names in the namespace, don't do anything special"
int main()
{
std::cout<<"Hello, world!"<<std::endl;
}