AIM: Write a c++ main function to create objects of distance class then input two distances and output the sum.
THEORY:
Develop a class to measure distance as feet (should be int), inches (should be float). Include member functions to set and get attributes. Include constructors. Develop functions to add two distances.
SOURCE CODE:
#include<iostream>
using namespace std;
class dist
{
public:
int feet,inch,x,y,z;
void input()
{
cout<<“enter feet and inches:”<<“\n”;
cin>>feet>>inch;
}
void show()
{
cout<<“The distance is “;
cout<<feet<<” feet “<<inch<<” inch\n”;
}
void sum(dist x,dist y)
{
feet=x.feet+y.feet;
inch=x.inch+y.inch;
if(inch>=12)
{
feet=feet+1;
inch=inch-12;
}
}
};
int main()
{
dist x,y,z;
x.input();
y.input();
z.sum(x,y);
z.show();
}
OUTPUT:
Enter feet and inches:
6 3
Enter feet and inches:
3 11
The distance is: 10 feet and 2 inches
JNTUK CSE R16 1-2 Computer Lab Exercise
Here we give all the list of programs which is following JAWAHARLAL NAHRU TECHNOLOGICAL UNIVERSITY, KAKINADA’s R16 Syllabus.
Here we provide Little Bit Introduction and SOURCE CODE for each and every program. Click here for JNTUK CSE R16 1-2 Computer Lab Exercise
Basic C programs
Basic c programs for Computer Science Engineering , Information Technology, Master of Computer Applications and Bachelor of Science students.
Here basic c programs for practicing in LAB for CSE, MCA, IT and BSC students.
Practicing Lab C Language basics for CSE, MCA, IT, BSc students.
Click here for Basic C programs
C language
C language is used to mathematical, business and scientific environments. Every language supports some pre-defined functions and keywords. Using those functions and keywords we can write any type of program statements. C language is one of most popular language in today’s programming language. A program is a group of statements or set of instructions. If we want to perform some task we can write some statements based on that find out the result.
Click here full Article on C Language.
1th biology
10th Maths
class 8 maths chapter 14
mensuration.in provides exercises and solutions for class 8 maths chapter 14
Click here for NCERT solutions for class 8 maths chapter 14