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;

}

Saturday 13 February 2016

PRACTICE PROBLEM 3 : (11-2 to 17-2) : Snake and Ladder

Please refer to the complete explanation video : HERE

Every view counts !!!!

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
void read_Values(board &b,snakes &snake_Det,ladders &ladder_Det,position &cur_Pos,rolls &r)
{
cin>>b.row;
cin>>b.col;
cin>>snake_Det.num;
for(int i=0;i<snake_Det.num;i++)
{
cin>>snake_Det.st_Grid[i];
cin>>snake_Det.end_Grid[i];
}
cin>>ladder_Det.num;
for(int i=0;i<snake_Det.num;i++)
{
cin>>ladder_Det.st_Grid[i];
cin>>ladder_Det.end_Grid[i];
}
cin>>cur_Pos.row;
cin>>cur_Pos.col;
cin>>r.num;
for(int i=0;i<r.num;i++)
{
cin>>r.roll[i];
}
}
int find_New_Pos(board &b,snakes &snake_Det,ladders &ladder_Det,position &cur_Pos, rolls &r)
{
for(int i=0;i<r.num;i++)
{
int g=(cur_Pos.row-1)*b.col+cur_Pos.col;
   g+=r.roll[i];
   cur_Pos.row=(g/b.col)+1;
   cur_Pos.col=g%b.col;
g=(cur_Pos.row-1)*b.col+cur_Pos.col;
for(int i=0;i<snake_Det.num;i++)
{
if(snake_Det.st_Grid[i]==g)
g=snake_Det.end_Grid[i];
//break;
}
for(int i=0;i<ladder_Det.num;i++)
{
if(ladder_Det.st_Grid[i]==g)
g=ladder_Det.end_Grid[i];
}
//cout<<cur_Pos.row<<",";
//cout<<cur_Pos.col<<endl;
   cur_Pos.row=(g/b.col)+1;
   cur_Pos.col=g%b.col;
}
return (cur_Pos.row-1)*b.col+cur_Pos.col;
}

Friday 12 February 2016

PRACTICE PROBLEM 3 : (11-2 to 17-2) : Tender scrutiny using refferrence variable


#include<iostream>
using namespace std;
class vendor
{
long r;
string name;
public:
long v;
void read()
{
cin>>r;
cin>>name;
cin>>v;
}
void display()
{
cout<<r<<endl;
cout<<name<<endl;
}
};
vendor * search(vendor * V,int n);
vendor * search(vendor * V,int n)
{
long min=V->v;
vendor * A;
A=V;
for(int i=0;i<n;i++)
{
if(min>V->v)
{
min=V->v;
A=V;
}
V++;
}
return A;

}
int main()
{
int n;
cin>>n;
vendor V[n];
for(int i=0;i<n;i++)
{
V[i].read();
}
vendor * MINV=search(&V[0],n);
MINV->display();


return 0;
}

PRACTICE PROBLEM 3 : (11-2 to 17-2) : Automatic vending machine

FOR DETAILED EXPLANATION : VIDEO
----------------------------------------------------------------------------------------------------------------------
Please watch the video,your views mean a lot!
========================================================================
#include<iostream>
using namespace std;
class item
{
long id;
long cost;
long stock;
public:
void read()
{
cin>>id;
cin>>cost;
cin>>stock;
}
int check(int n)
{
if(n==id)
return 1;
else
throw(0);
}
int costcheck(int n)
{
if(n>cost)
return 1;
else
throw(0.0);
}
int stockcheck()
{
if(stock>=1)
return 1;
else
throw string("ERROR");
}
void display()
{
cout<<id;
}


};
int main()
{
int n;
cin>>n;
item I[n];
for(int i=0;i<n;i++)
{
I[i].read();
}
int it,c;
cin>>it;
cin>>c;
int c2=0;
//cout<<"\n";
for(int i=0;i<n;i++)
{
try
{
I[i].check(it);
I[i].costcheck(c);
I[i].stockcheck();
I[i].display();
}
catch(int i)
{
c2++;
}
catch(double k)
{
cout<<"Insufficient amount"<<endl;
break;
}catch(string a)
{
cout<<"Less stock"<<endl;
break;
}
}
if(c2==n)
cout<<"Wrong item code";
return 0;
}

PRACTICE PROBLEM 3 : (11-2 to 17-2) : Guiding a Travelling Salesman


Given 'N' cities the possible paths will be the permutation of 'N-1' cities as start and the end city is mentioned(i.e the home city).
The permutations is given by (N-1)!.(factorial of N-1).
-------------------------------------------------------------------------------------------------------------
#include<iostream>
using namespace std;
int fact(int);
int fact(int n)
{
if(n==1)
return 1;
else
{
return n*fact(n-1);
}
}
int main()
{
int n;
cin>>n;
string city[n];
for(int i=0;i<n;i++)
{
cin>>city[i];
}
string home;
cin>>home;
cout<<fact(n-1);
return 0;
}

Wednesday 3 February 2016

THANK YOU ALL !

I know this has been long pending ..but i just could not put this to words.
A HEARTFELT THANKS ,
To all those who helped this site grow,in short, all those who publicized this blog.
All this would not have been possible without you.
I hope to be of more help in the future.
As Always, FEEDBACKS are always welcomed.
Go on , enjoy Riviera 16.

P.S Just one more news, the next assessment which was to be conducted just after riviera and before CAT-1 has a HIGH PROBABILITY of being CANCELLED.