Nitin Y.

Tutor for 2 years and Subject Matter Expert for Mechanical Engineering

Tutor Satisfaction Guarantee

Geometry

TutorMe

Question:

What is the length of the hypotenuse of a right angled triangle, whose adjacent sides are 3cm and 4cm.

Nitin Y.

Answer:

As we know, according to pythagoras theorem: (Hypotenuse^2) = (Height^2) + (Base^2) or, (Hypotenuse^2) = (3^2) + (4^2) or, (Hypotenuse^2) = 9 + 16 or, (Hypotenuse^2) = 25 taking square roots on both sides of equation, we get Hypotenuse = squareRoot(25) = 5cm or -5cm As, length can't be negative, so we can say Hypotenuse = 5cm

Mechanical Engineering

TutorMe

Question:

Explain briefly, the different theories of failure under static loading?

Nitin Y.

Answer:

Failure theories of a member subjected to bi-axial stress are as follows: ->Maximum principal stress theory ( Rankine’s theory): This theory states that failure occurs at a point in member where the maximum principal or normal stress in a bi-axial system reaches the maximum strength in a simple tension test. ->Maximum shear stress theory ( Guest’s or Tresca’s theory): This theory states that failure occurs when the biaxial stress reaches a value equal to the shear stress at yield point in a simple tension test. ->Maximum principal strain theory ( Saint Venant theory): This theory states that failure occurs when bi-axial stress reaches the limiting value of strain. ->Maximum strain energy theory ( Haigh’s theory): This theory states that failure occurs when strain energy per unit volume of the stress system reaches the limiting strain energy point. ->Maximum distortion energy theory ( Hencky and Von Mises theory): This theory states that failure occurs when strain energy per unit volume reaches the limiting distortion energy.

C++ Programming

TutorMe

Question:

Create a two player tic-tac-toe game in C++ language

Nitin Y.

Answer:

//Game Tic Tac Toe #include<iostream> #include<stdlib.h> using namespace std; template <size_t rows, size_t cols> void print_matrix(char (&a)[rows][cols]) { system("CLS"); cout<<endl<<'\t'<<"Tic Tac Toe"<<'\n'<<'\t'<<"___________"<<endl<<endl; cout<<"Player1 : <o> & Player2 : <x>"<<endl; cout<<"Type the number in the matrix where you want to enter the symbol"<<endl; cout<<endl; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ cout<<" "<<a[i][j]; if(j != 2) cout<<"|"; } cout<<endl; if(i != 2){ for(int i=0;i<3;i++){ cout<<"__"; if(i != 2) cout<<"|"; } } cout<<endl; } } template <size_t rows, size_t cols> bool check_winner(char (&t)[rows][cols], int p, char player) { switch(p){ case 1: if((t[0][1] == player && t[0][2] == player) || (t[1][0] == player && t[2][0] == player) || (t[1][1] == player && t[2][2] == player)) return 1;break; case 2: if((t[0][0] == player && t[0][2] == player) || (t[1][1] == player && t[2][1] == player)) return 1;break; case 3: if((t[0][0] == player && t[0][1] == player) || (t[1][2] == player && t[2][2] == player) || (t[1][1] == player && t[2][0] == player)) return 1;break; case 4: if((t[0][0] == player && t[2][0] == player) || (t[1][1] == player && t[1][2] == player)) return 1;break; case 5: if((t[0][0] == player && t[2][2] == player) || (t[2][0] == player && t[0][2] == player) || (t[1][0] == player && t[1][2] == player) || (t[0][1] == player && t[2][1] == player)) return 1;break; case 6: if((t[1][0] == player && t[1][1] == player) || (t[0][2] == player && t[2][2] == player)) return 1;break; case 7: if((t[0][0] == player && t[1][0] == player) || (t[2][1] == player && t[2][2] == player) || (t[1][1] == player && t[0][2] == player)) return 1;break; case 8: if((t[2][0] == player && t[2][2] == player) || (t[1][1] == player && t[0][1] == player)) return 1;break; case 9: if((t[0][0] == player && t[1][1] == player) || (t[2][0] == player && t[2][1] == player) || (t[0][2] == player && t[1][2] == player)) return 1;break; } return 0; } template <size_t rows, size_t cols> bool full_matrix(char (&a)[rows][cols]) { for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ if(a[i][j] != 'x' && a[i][j] != 'o') return 0; } } cout<<" It's a draw"<<endl; return 1; } template <size_t rows, size_t cols> void update_matrix(char (&t)[rows][cols],int p,char c) { int flag = 0; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ if(t[i][j] == p + '0'){ t[i][j] = c; flag = 1;break; } } if(flag) break; } print_matrix(t); } int main() { char t[3][3]; int n = 0; for(int i=0;i<3;i++){ for(int j=0;j<3;j++) t[i][j] = '0' + (++n); } int p; while(!full_matrix(t)){ print_matrix(t); cout<<" Player1 <o> :"; cin>>p; update_matrix(t,p,'o'); if(check_winner(t,p,'o')){ cout<<" Player1 is the winner"<<endl; break; } if(full_matrix(t)) break; print_matrix(t); cout<<" Player2 <x> :"; cin>>p; update_matrix(t,p,'x'); if(check_winner(t,p,'x')){ cout<<" Player2 is the winner"<<endl; break; } if(full_matrix(t)) break; } return 0; }

Send a message explaining your

needs and Nitin will reply soon.

needs and Nitin will reply soon.

Contact Nitin

Ready now? Request a lesson.

Start Session

FAQs

What is a lesson?

A lesson is virtual lesson space on our platform where you and a tutor can communicate.
You'll have the option to communicate using video/audio as well as text chat.
You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.

How do I begin a lesson?

If the tutor is currently online, you can click the "Start Session" button above.
If they are offline, you can always send them a message to schedule a lesson.

Who are TutorMe tutors?

Many of our tutors are current college students or recent graduates of top-tier universities
like MIT, Harvard and USC.
TutorMe has thousands of top-quality tutors available to work with you.