Code: Select all
void calculate()
{
system("CLS");
cout << "How many bits are being borrowed?\n";
cin >> bitsB;
Exp = bitsB;
TSub = pow(2, bitsB);
VSub = TSub - 2;
cout << "There will be " << TSub << " totals subnets.\n";
cout << "There will be " << VSub << " valid subnets.\n";
system("PAUSE");
listSubnts();
}
//************//
// listSubnts //
//************//
void listSubnts()
{
cout << "The first and last subnet can't be used.\n";
cout << "The first is the wire address, and the last is the broadcast address\n\n";
cout << oc1 << "." << oc2 << "." << oc3 << "." << "0\n";
}
Maybe that can explain better, though I don't think so. I'm not great at this stuff, only know a few commands and the such but I like learning all this.
Now let me explain what I am doing a little better.
I'll just say the number of bits that are being borrowed is 4.
So, the Increment is 2^4.
The Ip is going to be 192.168.10.5
The count starts at 192.168.10.0 and 16 is added to that last octet until hits 255.
In the code above you can see where I started the layout of the 192.168.10.0 but don't know where to go after that.
Maybe that will explain the questions you had?
edit: I'll explain the variables in a sec...got to run into town.