TAB

One of the works done by our Robotics and Machine Learning division,
SELF-LEVELING QUADCOPTER
Arduino based Quadcopter.
Self-leveling is acheived by the aligning the quadcopter using the readings from the gryo as well as the accelerometer.
A four channel RC transmitter is used to control the movement of the quadcopter when in flight. Kindly subscribe to our YouTube Channel and stay tuned.

Sunday 14 February 2016

PRACTICE PROBLEM 3 : (11-2 to 17-2) : Chess,Carrom,Scrabble

CODE:
void set::get()
{
int n;
cin>>n;
int i;
cin.get();
for(i=0;i<n;i++)
{
cin.getline(names[i],20);
}
names[i][0]='\0';
}
void set::print() const
{
int i=0;
while(names[i][0]!='\0')
{
if(i==0)
cout<<names[i];
else
cout<<","<<names[i];
i++;
}
cout<<endl;

}
set set::difference(set& a)
{
set diff;
int i=0;
int p=0;
while(names[i][0]!='\0')
{
int j=0;
int c=0;

while(a.names[j][0]!='\0')
{
if(strcmp(names[i],a.names[j])==0)
{
c=1;
break;
}
j++;
}
if(c!=1)
{
strcpy(diff.names[p],names[i]);
p++;
}
i++;
}
diff.names[p][0]='\0';
return diff;

}
set set::intersection(set& a)
{
set diff;
int i=0;
int p=0;
while(names[i][0]!='\0')
{
int j=0;
int c=0;

while(a.names[j][0]!='\0')
{
if(strcmp(names[i],a.names[j])==0)
{
c=1;
break;
}
j++;
}
if(c==1)
{
strcpy(diff.names[p],names[i]);
p++;
}
i++;
}
diff.names[p][0]='\0';
return diff;

}

1 comment:

  1. BRO ur blog is excellent no doubt but if we can also get the input processing output and the pseudocode then it wud be excellent :)

    ReplyDelete