#include "stdafx.h"
#include<iostream>
using namespace std;
class HurryUp
{
private:
int array[5][5];
char choice;
public:
HurryUp()
{
array[0][0]=0;
}
void set()
{
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
cout<<"Edge exist from "<<i<<" to "<<j<<"???('y'/'n')\n";
cin>>choice;
if(choice=='y')
{
array[i][j]=1;
}
else
{
array[i][j]=0;
}
}
}
}
void display()
{
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
cout<<array[i][j]<<"\t";
}
}
}
void remove()
{
cout<<"\nDo you want to remove link???\n";
cin>>choice;
if(choice=='y')
{
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
array[i][j]=0;
}
}
}
}
};
int main()
{
HurryUp s1;
s1.set();
s1.display();
s1.remove();
s1.display();
return 0;
}
No comments:
Post a Comment