Bonus Practice Sheet Winter 2018 [17-Mar-2018 to 7-Apr-2018]
Program ID- 2782
Given a point in three-dimensional space with x-coordinate, y-coordinate, z-coordinates, Provide a function increment with one, two and three parameters to transform the values of all the three coordinates. When the function with one parameter is called increment all the three , by same value . When the function with two arguments is called multiply each coordinates by the sum of the two parameters. when the function with three arguments is called, increment x-coordinate by the value of first parameter, y-coordinate by the value of the second parameter and z-coordinate by the value of the third parameter.
Input Format
Enter the coordinates of the point
X-coordinate
Y-coordinate
Z-coordinate
Enter the increment value for function with one parameter
Enter the values for the function with two parameters
Enter the increment values for function with three parameters
Output Format
Display the coordinates of the point after calling function with one parameter
Display the coordinates of the point after calling function with two parameters
Display the coordinates of the point after calling function with three parameters
Please Comment Working if the code worked to you
If you have other working codes please comment the codes enclosing with <pre> and </pre>
Example: <pre> Your Code </pre>
Input Format
Enter the coordinates of the point
X-coordinate
Y-coordinate
Z-coordinate
Enter the increment value for function with one parameter
Enter the values for the function with two parameters
Enter the increment values for function with three parameters
Output Format
Display the coordinates of the point after calling function with one parameter
Display the coordinates of the point after calling function with two parameters
Display the coordinates of the point after calling function with three parameters
Please Comment Working if the code worked to you
If you have other working codes please comment the codes enclosing with <pre> and </pre>
Example: <pre> Your Code </pre>
Code: C++
#include< iostream >
using namespace std;
class dim
{
int a,b,c;
public :
void get()
{
cin>>a>>b>>c;
}
void increment(int val)
{
a+=val;
b+=val;
c+=val;
}
void increment(int Int_Input_1,int Int_Input_2)
{
a*=Int_Input_1+Int_Input_2;
b*=Int_Input_1+Int_Input_2;
c*=Int_Input_1+Int_Input_2;
}
void increment(int Int_Input_1,int Int_Input_2,int Int_Input_3)
{
a+=Int_Input_1;
b+=Int_Input_2;
c+=Int_Input_3;
}
void print()
{
cout<<a<<endl<<b<<endl<<c<<endl;
}
};
using namespace std;
class dim
{
int a,b,c;
public :
void get()
{
cin>>a>>b>>c;
}
void increment(int val)
{
a+=val;
b+=val;
c+=val;
}
void increment(int Int_Input_1,int Int_Input_2)
{
a*=Int_Input_1+Int_Input_2;
b*=Int_Input_1+Int_Input_2;
c*=Int_Input_1+Int_Input_2;
}
void increment(int Int_Input_1,int Int_Input_2,int Int_Input_3)
{
a+=Int_Input_1;
b+=Int_Input_2;
c+=Int_Input_3;
}
void print()
{
cout<<a<<endl<<b<<endl<<c<<endl;
}
};
NOTE: The Above Codes are for reference only. It doesn't mean everyone to directly copy/paste those codes.
nice article for beginners.thank you.
ReplyDeleteC++ tutorial
java tutorial