0% found this document useful (0 votes)
24 views

Problem 88787

The document contains 11 C++ programs that demonstrate basic programming concepts like input/output, arithmetic operations, conditional statements, and functions. The programs include: 1. Printing text and user input 2. Adding, multiplying and finding remainder of integers 3. Checking if a number is even/odd, vowel/consonant, positive/negative 4. Calculating area of shapes and division of student marks 5. Checking for leap years and series summations 6. Reversing numbers and finding largest of inputs 7. Calculating digit sums and using functions The programs provide examples of fundamental C++ skills for beginners to learn programming logic and basic syntax.

Uploaded by

Mahin
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Problem 88787

The document contains 11 C++ programs that demonstrate basic programming concepts like input/output, arithmetic operations, conditional statements, and functions. The programs include: 1. Printing text and user input 2. Adding, multiplying and finding remainder of integers 3. Checking if a number is even/odd, vowel/consonant, positive/negative 4. Calculating area of shapes and division of student marks 5. Checking for leap years and series summations 6. Reversing numbers and finding largest of inputs 7. Calculating digit sums and using functions The programs provide examples of fundamental C++ skills for beginners to learn programming logic and basic syntax.

Uploaded by

Mahin
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Problem: 1.1:C++ Program to Print a Sentence.

#include<iostream>
using namespace std;
int main()
{
cout<<"Hello World"<<endl;
return 0;
}

Problem: 1.2: C++ Program to Print a Integer Entered by a User


#include<iostream>
using namespace std;
int main()
{
int a;
cout<<"enter any number: ";
cin>>a;
cout<<"number you entered:"<<a;
return 0;
}

Problem: 1.3: C++ Program to Add Two Integers


#include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"please enter any two numbers: ";
cin>>a>>b;
cout<<a+b;
return 0; }
Problem: 1.4: C++ Program to Multiply two Floating Point Numbers
#include<iostream>

using namespace std;

int main()

float a,b;

cout<<"please enter any two numbers: ";

cin>>a>>b;

cout<<(a*b);

return 0;

Problem: 1.5: C++ Program to Find ASCII Value of a Character


#include<iostream>

using namespace std;

int main()

char a;

cout<<"please enter any character: ";

cin>>a;

cout<<int(a);

return 0;}

Problem: 1.6: C++ Program to Find Quotient and Remainder of Two Integers Entered by User
#include<iostream>

using namespace std;

int main()

int a,b;

cout<<"please enter any two numbers: ";

cin>>a>>b;

cout<<a/b<<endl;

cout<<(a%b);

return 0;

1
Problem: 1.7: C++ Program to Swap Two Numbers
#include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"please enter any two numbers: ";
cin>>a>>b;
a=(a+b);
b=(a-b);
a=(a-b);
cout<<a<<endl;
cout<<b; return 0;}

Problem: 1.8: C++ Program to Check Whether a Number is Even or Odd


#include<iostream>
using namespace std;
int main()
{
int a;
cout<<"please enter any number: ";
cin>>a;
if (a%2==0)
cout<<"The number is Even";
else
cout<<"The number is Odd";
return 0;
}

2
Problem: 1.9: C++ Program to Check Vowel or Consonant
#include <iostream>

using namespace std;

int main()

char a;

cout<<"Enter any letter: ";

cin>>a;

a=tolower(a);

if (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u' )

cout <<a<< " is a Vowel" << endl;

else

cout <<a<< " is a Consonant" << endl;

return 0;

Problem: 1.10: C++ Program to Find the Largest Number Among Three Numbers
#include <iostream>

using namespace std;

int main()

int num1,num2,num3;

cout<<"Enter any three numbers: ";

cin>>num1>>num2>>num3;

if (num1>=num2 && num1>=num3)

cout <<num1<<" is the largest number" << endl;

else if (num2>=num1 && num2>=num3)

cout <<num2<< " is the largest number" << endl;

else

cout<<num3<<" is the largest number";

return 0;
3
}

Problem: 2.1: C++ program to Find all Roots of a Quadratic equation


#include<bits/stdc++.h>

#include<math.h>

#include<conio.h>

using namespace std;

int main()

float a,b,c,d,x1,x2;

cout<<"enter three numbers : ";

cin>>a>>b>>c;

if(a==0 && b==0)

cout<<"not a quadratic equation";

else

d=(b*b)-(4*a*c);

if(d>=0)

x1=(-b+sqrt(d))/(2*a);

x2=(-b-sqrt(d))/(2*a);

cout<<"Roots are real""\n";

cout<<"x1 : "<<x1<<"\n";

cout<<"x2 : "<<x2<<"\n";

else

cout<<"Roots are not real";

}}

getch();

}
4
Problem: 2.2: C++ Program to Check Whether a Number is Positive or Negative
#include<bits/stdc++.h>

using namespace std;

int main()

float num;

cout<<"Enter any number: ";

cin>>num;

if(num>=0)

cout<<"Positive";

else

cout<<"Negetive";

getch();

Problem: 2.3: C++ Program to input a number. If the number is even, print its square otherwise print its cube.
#include<bits/stdc++.h>

#include<math.h>

using namespace std;

int main(){

int num;

cout<<"Enter any number: ";

cin>>num;

if(num%2==0)

cout<<"Even"<<endl;

cout<<"square of y=the number is: "<<num*num;

else

cout<<"Odd"<<endl;

5
cout<<"cube of the number is: "<<num*num*num;

getch();

Problem: 2.4: C++ Program to input marks in three subjects of a student and calculate the
division
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
int i,mark;
cout<<"enter the marks of a student: ""\n";
for(i=0; i<3; i++)
{
cout<<"subject "<<i+1<<": ";
cin>>mark;
if(mark>=60)
cout<<"Division: First""\n";
else if(mark<=59 && mark>=50)
cout<<"Division : Second""\n";
else if(mark<=49 && mark>=40)
cout<<"Division: Third""\n";
else
cout<<"Division: Fail""\n";
}
getch();
}

6
Problem: 2.5: C++ Program to check that a given year is a leap year or not. If not then calculate
the nearest leap year.
#include <bits/stdc++.h>

using namespace std;

bool LeapYear(int year){

return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);

int findNearestLeapYear(int year){

int pastYear = year - 1;

int futureYear = year + 1;

while (!LeapYear(pastYear))

pastYear--;

while (!LeapYear(futureYear))

futureYear++;

if (year - pastYear <= futureYear - year)

{return pastYear;}

else

return futureYear;

int main()

int year;

cout << "Enter a year: ";

cin >> year;

7
int nearestLeapYear = findNearestLeapYear(year);

cout << "The nearest leap year to " << year << " is " << nearestLeapYear << endl;

return 0;}

Problem: 2.6: C++ Program to input a character and check that it’s a small letter, capital letter,
a digit or a special symbol.
#include<bits/stdc++.h>
#include<math.h>
#include<conio.h>
using namespace std;
int main()
{
char ch;
int i;
for(i=0; i<4; i++)
{
cout<<"enter any character: ";
cin>>ch;
if(ch>='a' && ch<='z')
cout<<"Small letter""\n";
else if(ch>='A' && ch<='Z')
cout<<"Capital letter""\n";
else if(ch>='0' && ch<='9')
cout<<"A digit""\n";
else
cout<<"A special symbol""\n";
}
getch();

8
}

Problem: 2.7: Write a C++ program to find out the sum of series 1 + 2 + …. + n.
#include<bits/stdc++.h>
#include<math.h>
#include<conio.h>
using namespace std;
int main()
{
int i,num,sum=0;
cout<<"enter any number: ";
cin>>num;
for(i=0;i<=num;i++)
{
sum=sum+i;
cout<<i<<" ";
}
cout<<"\n""sum of the series: "<<sum;

getch();
}

9
Problem: 2.8: Write a C++ program to find out the sum of series 1^3 + 2^3 + …. + n^3.
#include<bits/stdc++.h>
#include<math.h>
#include<conio.h>
using namespace std;
int main()
{
int i,num,sum=0;
cout<<"enter any number: ";
cin>>num;
for(i=0;i<=num;i++)
{
sum=sum+(i*i*i);
cout<<i*i*i<<" ";
}
cout<<"\n""sum of the series: "<<sum<<endl;

getch();
}

10
Problem: 2.9: Write a C++ Program to Reverse a Number.
#include<bits/stdc++.h>
#include<math.h>
#include<conio.h>
using namespace std;
int revnum(int num)
{
int rev = 0;
while (num != 0)
{
int digit = num % 10;
rev = rev * 10 + digit;
num /= 10;
}
return rev;
}
int main()
{
int num;
cout << "Enter a number: ";
cin >> num;
int reverseNum = revnum(num);
cout << "Reversed number: " << reverseNum << endl;
getch();
11
}

Problem: 2.10: Write a C++ Program to


find largest of n numbers
#include<bits/stdc++.h>
#include<math.h>
#include<conio.h>
using namespace std;
int main()
{
int i,n;
double num,largest;
cout << "Enter the number of elements: ";
cin >> n;
if(n<=0)
{
cout<<"invalid number""\n""please enter the number again: ";
return 1;
}
cout<<"enter the number 1: ";
cin>>largest;
for(i=1; i<n; i++)
{
cout<<"enter the number "<<i+1<<": ";
cin>>num;
if(num>largest)
12
{
largest=num;
}
}
cout<<"The largest number is : "<<largest;
getch();
}

Problem: 2.11: Write a C++ program to input any number from user and displays the total of its
digits
#include<bits/stdc++.h>
#include<conio.h>
using namespace std;
int main()
{
int num,remainder,sum=0,OriginalNumber;
cout<<"enter any number: ";
cin>>num;
OriginalNumber=num;
while(num!=0)
{
remainder=num%10;
sum=sum+remainder;
num=num/10;
}
cout<<"The sum of the total digit "<<OriginalNumber<<" is: "<<sum<<endl;
getch();
}

13
Problem: 3.1: Write a C++ program that calculates and displays the area of a circle. The program should
prompt the user to enter the radius of the circle and then output the calculated area. Utilize a function area to
perform the area calculation, and include the necessary header files and constants

#include<bits/stdc++.h>
#include<conio.h>
#include<math.h>
using namespace std;
int area(int length, int width)
{
return length*width;
}
int main()
{
int length,width;
cout<<"enter length and width of a rectangle: ";
cin>>length>>width;
int rectangle=area(length,width);
cout<<"the area of a rectangle is: "<<rectangle;
getch();
}

14
Problem: 3.2: Write a C++ program that calculates and displays the area of a rectangle. The program should
prompt the user to enter the length and width of the rectangle and then output the calculated area. Use the
function calculateArea to perform the area calculation.

#include<bits/stdc++.h>
#include<conio.h>
#include<math.h>
using namespace std;
float area(int r)
{
return 3.1416*r*r;
}
int main()
{
int radius;
cout<<"enter the radius of a circle: ";
cin>>radius;
float circle=area(radius);
cout<<"the area of a circle is: "<<circle;
getch();
}
Problem: 3.3 Write a C++ program that take two functions that gets three integers and returns
maximum and minimum.
#include<bits/stdc++.h>
#include<conio.h>
#include<math.h>
using namespace std;
int midNum(int num1,int num2,int num3)

15
{
if(num2>=num1 && num3<=num1)
return num1;
else if(num1>=num2 && num3<=num2)
return num2;
else
return num3;
}
int main()
{
int num1,num2,num3;
cout<<"enter the three numbers: ";
cin>>num1>>num2>>num3;
int midium=midNum(num1,num2,num3);
cout<<"the midium number among three number is: "<<midium;
getch();
}
Problem: 3.4: Write a function that gets any
positive number and returns its factorial.
#include<bits/stdc++.h>
#include<conio.h>
#include<math.h>
using namespace std;
int factorial(int n)
{
if(n<=0)
return 1;

16
else
return n*factorial(n-1);
}
int main()
{
int num;
cout<<"enter any positive number: ";
cin>>num;
int fact=factorial(num);
cout<<"the factorial of "<<num<<" is: "<<fact;
getch();
}

Problem 3.5: Write a function that gets any positive number and returns sum of its digit
#include<bits/stdc++.h>
#include<conio.h>
#include<math.h>
using namespace std;
int sumDigits(int num)
{
int remainder,sum=0;
while(num>0)
{
remainder=num%10;
sum=sum+remainder;
num=num/10;

17
}
return sum;
}
int main()
{
int num;
cout<<"enter any positive number: ";
cin>>num;
if(num<0)
cout<<"Error! please
enter a positive number";
else
{
int sum=sumDigits(num);
cout<<"the sum of "<<num<<" is: "<<sum;
}
getch();
}
Problem: 3.6: Write a function that gets any positive number and returns digital root.
#include<bits/stdc++.h>
#include<conio.h>
#include<math.h>
using namespace std;
int digital(int num)
{
int sum=0;
if(num<10)

18
return num;
else
{
while(num>0)
{
sum=sum+(num%10);
num=num/10;
}
return digital(sum);
}
}
int main()
{
int num;
cout<<"enter any positive number: ";
cin>>num;
int root=digital(num);
if(num<0)
cout<<"error! please enter any positive number: ";
else
cout<<"the digital root of "<<num<<" is: "<<root;
getch();
}
Problem: 3.7: Write a C++ program that take four functions that gets two integer and returns its
sum ,subtraction, multiplication, division.
#include<bits/stdc++.h>
#include<conio.h>

19
#include<math.h>
using namespace std;
int sum(int num1,int num2)
{
return num1+num2;
}
int sub(int num1,int num2)
{
return num1-num2;
}
int multiple(int num1,int num2)
{
return num1*num2;
}
float divide(int num1,int num2)
{
return num1/num2;
}
int main()
{
int num1,num2;
cout<<"enter any two numbers: ";
cin>>num1>>num2;
int sumNumber,subNumber,multiplication;
float divideNumber;
sumNumber=sum(num1,num2);
subNumber=sub(num1,num2);

20
multiplication=multiple(num1,num2);
divideNumber=divide(num1,num2);
cout<<"the sum two number is: "<<sumNumber<<"\n";
cout<<"the sub two number is: "<<subNumber<<endl;
cout<<"the multiplication of two number is: "<<multiplication<<endl;
cout<<"the dividation of two number is: "<<divideNumber<<endl;
getch();
}
Problem: 3.8:
#include<bits/stdc++.h>
#include<conio.h>
#include<math.h>
using namespace std;
int maximum(int num1,int num2,int num3)
{
if(num1>=num2 && num1>=num3)
return num1;
else if(num2>=num1 && num2>=num3)
return num2;
else
return num3;
}
int minimum(int num1,int num2,int num3)
{
if(num1<=num2 && num1<=num3)
return num1;
else if(num2<=num1 && num2<=num3)

21
return num2;
else
return num3;
}

int main()
{
int num1,num2,num3;
cout<<"enter any three numbers: ";
cin>>num1>>num2>>num3;
int maxNum,minNum;
maxNum=maximum(num1,num2,num3);
minNum=minimum(num1,num2,num3);
cout<<"the maximum number is: "<<maxNum<<"\n";
cout<<"the minimum number is: "<<minNum<<endl;
getch();
}

Problem: 3.9: Write a C++ program using user-define function that calculates and displays the
averages of sets of numbers.

#include<bits/stdc++.h>
#include<conio.h>
#include<math.h>
using namespace std;
void average(int num1,int num2)
{
cout<<"enter any two numbers: ";
22
cin>>num1>>num2;
int avg=(num1+num2)/2;
cout<<"average of two numbers: "<<avg<<endl<<endl;
}
void average(float num1,float num2,float num3)
{
cout<<"enter any three numbers: ";
cin>>num1>>num2>>num3;
float avg=(num1+num2+num3)/3;
cout<<"average of three numbers: "<<avg<<endl<<endl;
}

void average(long num1,double num2,double num3,double num4)


{
cout<<"enter any four numbers: ";
cin>>num1>>num2>>num3>>num4;
double avg=(num1+num2+num3+num4)/4;
cout<<"average of four numbers: "<<avg<<endl<<endl;
}

int main()
{
double num1,num2,num3,num4;
average(num1,num2);
average(num1,num2,num3);
average(num1,num2,num3,num4);
getch();

23
}

Problem 4.1:
#include<iostream>
#include<conio.h>
using namespace std;
class person
{
string
name,country;
int age;

public:
person()
{
name="Md.Mohaimin Mahin";
country = "Bangladesh";
age=23;
cout<<"constructor created"<<endl;

}
~person()
{
cout<<"Person's name is: "<<name<<endl;
cout<<"His Country name: "<<country<<endl;
cout<<"His age: "<<age<<endl;

24
cout<<"destruction done"<<endl;
}

};
int main()
{
person one;
return 0;
}

Problem 4.2:
#include<iostream>
#include<conio.h>
using namespace std;
class Box
{
float height,length,width;

public:
Box()
{
height=4;
length=5;
width=2;
cout<<"constructor created"<<endl;

}
float print_volume()
{
25
return height*length*width;
}
~Box()
{
cout<<"The height,length,width of the Box: 4,5,2"<<endl;
cout<<"The volume of the Box: "<<print_volume()<<endl;
cout<<"destruction done"<<endl;
}

};
int main()
{
Box vol;
return 0;
}
Problem 4.3:
#include<iostream>
#include<conio.h>
using namespace std;
class registerer
{
string name,address,blood_group,date_of_birth;
int idnumber;

public:

26
void contain(string n,string a,string b,string d,int i)
{
name=n;
address=a;
blood_group=b;
date_of_birth=d;
idnumber=i;

}
void display()
{
cout<<"Name of the person: "<<name<<endl;
cout<<"Address of the person: "<<address<<endl;
cout<<"Blood group of the person: "<<blood_group<<endl;
cout<<"Date of birth of the person: "<<date_of_birth<<endl;
cout<<"ID of the person: "<<idnumber<<endl;
}

};
int main()
{
registerer person;
string n,a,b,d;
int i;
cout<<"Enter name: "<<endl;
getline(cin,n);
cout<<"Enter address: "<<endl;
getline(cin,a);
27
cout<<"Enter blood group: "<<endl;
getline(cin,b);
cout<<"Enter date of birth: "<<endl;
getline(cin,d);
cout<<"Enter ID: "<<endl;
cin>>i;
cout<<endl<<endl;
cin.ignore();

person.contain(n,a ,b,d,i);
person.display();
return 0;
}

Problem 5.1:
#include<iostream>

#include<conio.h>

using namespace std;

class calculator

{ int a=24,b=4;

int sum()

return a+b;

int sub()

return a-b;

int multiplication()

28
{

return a*b;

float division()

return a/b;

public:

void show()

{ cout<<"sum of 24 & 4 is: "<<sum()<<endl;

cout<<"sub of 24 & 4 is: "<<sub()<<endl;

cout<<"multiplication of 24 & 4 is: "<<multiplication()<<endl;

cout<<"division of 24 & 4 is: "<<division()<<endl;

};

int main()

calculator cal;

cal.show();

return 0;

Problem 5.2:
#include<iostream>

#include<conio.h>

using namespace std;

int prime(int n)

int i,f=1;

for(i=2; i<=n/2; i++)

29
if(n%i==0)

f=0;

return f;

int main()

int n,m,primeNum;

cout<<"enter two positive number: ";

cin>>n>>m;

for(int i=n; i<m; i++)

primeNum=prime(i);

if(primeNum==1)

cout<<i<<" ";

}}

return 0;

Problem 5.3:
#include<iostream>

#include<conio.h>

using namespace std;

int fibo(int n)

if(n==0 || n==1)

return 1;

else

30
return (fibo(n-1)+fibo(n-2));

int main()

int n,fibonacci;

cout<<"enter any positive number: ";

cin>>n;

cout<<"Fibonacci series of "<<n<<" is: "<<endl;

for(int i=0;i<=n; i++)

fibonacci=fibo(i);

cout<<fibonacci<<" ";

return 0;

Problem 5.4:
#include<iostream>

#include<conio.h>

using namespace std;

class circle

int radius;

public:

void comput_area(int r)

radius=r;

float area=3.1416*radius*radius;

cout<<"The area of circle is: "<<area<<endl;

};

31
int main()

circle cir;

int r;

cout<<"enter the radius of a circle: ";

cin>>r;

cout<<endl;

cir.comput_area(r);

return 0;

Problem 5.5:
#include<iostream>

#include<conio.h>

using namespace std;

class summation

int number1,number2;

public:

void sum(int n1,int n2)

number1=n1;

number2=n2;

int add=number1+number2;

cout<<"The summation of two number is: "<<add<<endl;

};

int main()

summation add;

int n1,n2;

32
cout<<"enter the two numbers: ";

cin>>n1>>n2;

cout<<endl;

add.sum(n1,n2);

return 0;

Problem 5.6:
#include<iostream>

#include<conio.h>

using namespace std;

class rectangle

int length,width;

public:

void set1()

length=4;

width=6;

int get_area()

return length*width;

};

int main()

rectangle box;

box.set1();

float area=box.get_area();

cout<<"Area of a rectangle: "<<area<<endl;

33
return 0;

Problem 5.7:
#include<iostream>
#include<conio.h>
using namespace std;
class calculator
{
int a=24,b=4;
int sum()
{
return a+b;
}
int sub()
{
return a-b;
}
int
multiplication()
{
return a*b;
}
float division()
{
return a/b;
}

34
public:
void show()
{
cout<<"sum of 24 & 4 is: "<<sum()<<endl;
cout<<"sub of 24 & 4 is: "<<sub()<<endl;
cout<<"multiplication of 24 & 4 is: "<<multiplication()<<endl;
cout<<"division of 24 & 4 is: "<<division()<<endl;
}
};
int main()
{
calculator cal;
cal.show();
return 0;
}

Problem 6.1:
#include<iostream>
#include<conio.h>
using namespace std;
class card
{
string title,author;
int num_books;

public:
void store()
35
{
title="A Brief Histroy of Time";
author="Stephen Howkings";
num_books=50;
}
void display()
{
cout<<"Name of the book: "<<title<<endl;
cout<<"Name of the author: "<<author<<endl;
cout<<"number of books: "<<num_books<<endl;
}
};
int main()
{
card one;
one.store();
one.display();
return 0;
}

Problem 6.2:
#include<iostream>
#include<conio.h>
using namespace std;
class prime
{
int num;
36
public:
void get_input()
{
int n;
cout<<"enter any positive number: ";
cin>>n;
num=n;
}
int calculate()
{
int i,f=1;
for(i=2;i<num/2;i++)
{
if(num%i==0)
return 0;
}
return f;
}
void display()
{
int primenum=calculate();
if(primenum==1)
cout<<"Given number is prime number"<<endl;
else
cout<<"Given number is not prime number"<<endl;
}

37
};
int main()
{
prime number;
number.get_input();
number.display();
return 0;
}

Problem 6.3:
#include<iostream>
#include<conio.h>
using namespace std;
class student
{
string name;
int ID;
float cgpa;
public:
student(string n,int i,float c)
{ name=n;
ID=i;
cgpa=c;
}
friend void studentinfo(student info);
};
void studentinfo(student info)
38
{
cout<<"the information of the student is given below"<<endl<<endl;
cout<<"name of the student: "<<info.name<<endl;
cout<<"Student's ID: "<<info.ID<<endl;
cout<<"Student's CGPA: "<<info.cgpa<<endl;
}
int main()
{
string n;
int i;
float c;
cout<<"enter students name: ";
getline(cin,n);
cout<<"enter students ID: ";
cin>>i;
cout<<"enter students CGPA: ";
cin>>c;
cout<<endl;
student info(n,i,c);
studentinfo(info);
}

Problem 6.4:
#include<iostream>
#include<conio.h>
using namespace std;
class registerer
39
{
string name,address,blood_group,date_of_birth;
int idnumber;
public:
void contain(string n,string a,string b,string d,int i)
{
name=n;
address=a;
blood_group=b;
date_of_birth=d;
idnumber=i;

}
void display()
{
cout<<"Name of the person: "<<name<<endl;
cout<<"Address of the person: "<<address<<endl;
cout<<"Blood group of the person: "<<blood_group<<endl;
cout<<"Date of birth of the person: "<<date_of_birth<<endl;
cout<<"ID of the person: "<<idnumber<<endl;
}
};
int main()
{
registerer person;
string n,a,b,d;

40
int i;
cout<<"Enter name: "<<endl;
getline(cin,n);
cout<<"Enter address: "<<endl;
getline(cin,a);
cout<<"Enter blood group: "<<endl;
getline(cin,b);
cout<<"Enter date of birth: "<<endl;
getline(cin,d);
cout<<"Enter ID: "<<endl;
cin>>i;
cout<<endl<<endl;
cin.ignore();
person.contain(n,a,b,d,i);
person.display();
return 0;
}

41

You might also like