-
Notifications
You must be signed in to change notification settings - Fork 0
/
vlsm.cpp
57 lines (39 loc) · 1.21 KB
/
vlsm.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/******************************************************************************
VLSM Calculator
*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
string inputIp,inputSubnet;
int i,n=0;
int sum=0;
//int k=1;
printf("How many network do you have in your topology? : ");
cin>>n;
int array[n];
//input networks
for(int i=1; i<=n;i++){
cout<<i<<" No. Network: ";
cin>>array[i];
}
printf("\nNetwork List: ");
printf("\n============================\n");
//showing inputed networks
for(int i=1; i<=n;i++){
cout<<i<<" No. Network: "<<array[i]<<endl;
//adding inputed network
sum=sum+array[i];
}
printf("\n============================\n");
cout<<"Total Networks: "<<sum<<"\n";
printf("\n============================\n");
//cout<<"\n"<<i<<" No. Network: "<<array[i];
printf("Network List: \n");
printf("Enter the prefer network address: ");
cin>>inputIp;
printf("Input Subnet Mask: ");
cin>>inputSubnet;
cout<<inputIp<<"/"<<inputSubnet;
return 0;
}