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.

Tuesday, 8 March 2016

PRACTICE PROBLEM 4:vector

THIS IS A VERY IMPORTANT PROBLEM PLEASE MAKE SURE YOU UNDERSTAND IT COMPLETELY....
--------------------------------------------------------------------------------------------------------------------------
DETAILED  EXPLAINATION : HERE

========================================================================
istream& operator>>(istream& in,vector& v)
{
in>>v.num;
int i;
for(i=0;i<v.num;i++)
{in>>v.ele[i];
}
return in;
}
ostream& operator<<(ostream& in,vector& v)
{
int i;
for(i=0;i<v.num;i++)
in<<v.ele[i]<<endl;
return in;
}
vector vector::operator+(vector& v)
{
vector temp;
if(num>v.num)
temp.num=num;
else
temp.num=v.num;
for(int i=0;i<num;i++)
{
temp.ele[i]=ele[i]+v.ele[i];
}
return temp;
}
vector vector::operator-(vector& v)
{
vector temp;
if(num>v.num)
temp.num=num;
else
temp.num=v.num;
for(int i=0;i<num;i++)
{
temp.ele[i]=ele[i]-v.ele[i];
}
return temp;
}
int vector::operator[](int i)
{
return ele[i-1];
}

PRACTICE PROBLEM 4: passenger


     #include<iostream>
using namespace std;
class passenger
{
string name;
int x;
int age;
string Address;
string date;
string mobile;
int fare;
public:
void get();
void disp();
friend void discount(passenger &p);
};
void passenger::get()
{
cin>>name;
cin>>x;
cin>>age;
cin>>Address;
cin>>date;
cin>>mobile;
cin>>fare;
}
void passenger::disp()
{

cout<<name<<endl;
cout<<"CA"<<x<<endl;
cout<<age<<endl;
cout<<date<<endl;
cout<<mobile<<endl;
cout<<fare<<endl;
}
void discount(passenger &p)
{
if(p.age<12)
p.fare-=p.fare/2;
else if(p.age<58)
p.fare-=p.fare/5;
else
p.fare-=p.fare*2/5;
}
int main()
{
passenger p;
p.get();
discount(p);
p.disp();
return 0;
}

PRACTICE PROBLEM 4:stock

void item::get()
{
cin>>prod_name;
cin>>prod_code;
cin>>prod_price;
cin>>stock_In_Hand;
}
void item::print() const
{
cout<<prod_name<<endl;
cout<<prod_code<<endl;
cout<<prod_price<<endl;
cout<<stock_In_Hand<<endl;
}
void store::get_details()
{
int i;
cin>>num_Of_Items;
for(i=0;i<num_Of_Items;i++)
{
items[i].get();
}
}
void store_keeper::stock_mgmt(store &s)
{
int i;
for(int i=0;i<s.num_Of_Items;i++)
{
if(s.items[i].stock_In_Hand<10)
s.items[i].print();
}
}

PRACTICE PROBLEM : Area function overload

#include<iostream>
#include<iomanip>
using namespace std;
float area(float a,float b)
{
return a*b;
}
float area(float t,float b,float h)
{
return(h*(t+b)/2);
}
float area(float r)
{
return 3.14*r*r;
}

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.