Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
ohh plz no plz no!... I totally dislike namespaces. It makes the code hard to follow when you're not familiar with it or doesn't have a good IDE. It's "ok" to use them on huge libraries like boost in order to save you a few keystrokes, for example:
boost::asio::ip::tcp::resolver::query
...Now thats fucking huge. But still, thats no excuse to risk readability and a few more issues that comes along with namespaces, just for a syntactic sugar.
Well, thats actually the same as my first example (and I'm talking about the usage of preprocessor definitions) with the difference that it return a value... which at the end it's almost the same as mine. But yeh
Was learning some basics and came into making a little code , i dont get compile errors but after the first loop is done other ones is messed up it keep sending lines untill loop finishes (without waiting for input to continue) , tryed to remove getline() and replaced with cin and it worked well , but i need to get the whole line :
Code:
#include "iostream"
#include "cstdlib"
#include "string"
using namespace std;
struct db
{
int num;
string str;
};
int main ()
{
db p[10];
db *f = p;
int x = 0;
while (x<10)
{
cout << "What is his name?"<<endl;
getline(cin,f[x].str);
cout << "What is "<< f[x].str << "'s age?" <<endl;
cin>>f[x].num;
x++;
}
cout << "Name \t Age"<<endl;
for(int y = 0; y<10 ; y++)
{
cout<< f[y].str << "\t" << f[y].num << endl;
}
system("PAUSE");
return 0;
}