SlideShare a Scribd company logo
1 of 3
Download to read offline
1.
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
struct student
{
int ID; // 4 bytes
char name[10];//10bytes
float grade; // 4bytes
int age; // 4
char phone[10]; // 10
char e_mail[16]; // 16
};
void display(struct student s)
{
cout<<setw(3)<< s.ID <<setw(12)<< s.name <<setw(8)<< setiosflags (ios::showpoint)<<setprecision(2)<<
s.grade<<setw(5)<<s.age <<setw(10)<< s.phone<< setw(18)<<s.e_mail<<endl;
}
void main()
{
struct student s1={55,"Amir Ali",3.5f,23,"6535418","amir@yahoo.com"};
struct student s2={26,"Mujahid",2.9888f,25,"5362169", "muj@hotmail.com"};
struct student s3={39,"M Jamil",3.108f,30,"2345677","jam@hotmail.com"};
struct student s4={44,"Dilawar",2.7866f,31,"5432186","dil@hotmail.com"};
struct student s5={59,"S.Naveed",2.9f,27,"2345671","navee@yahoo.com"};
cout<<" Students Records Sheetn";
cout<<" ~~~~~~~~~~~~~~~~~~~~~~nn";
cout<<"ID# NAME GRADE AGE PHONE E-MAILn";
cout<<"~~~ ~~~~ ~~~~~ ~~~ ~~~~~ ~~~~~~~n";
display(s1); // structure pass to function
display(s2); // structure pass to function
display(s3);
display(s4);
display(s5);
}
2.
// In this program you will see the structures (members Manipulation),
// Passing structures to functions:
#include <iostream.h>
#include <iomanip.h>
struct S_Details
{
char name [30];
int exam1;
int exam2;
int exam3;
int final;
float sem_ave;
char letter_grade;
};
//inputs the data items for a student, structure
//is passed by reference
struct S_Details get_stu ( )
{
struct STU_GRADES student;
cout << "nnnn Enter the information for a studentn";
cout << " Name: ";
cin.getline (student.name, 30, 'n');
cout << " Exam1: ";
cin >> student.exam1;
cout << " Exam2: ";
cin >> student.exam2;
cout << "exam3: ";
cin >> student.exam3;
cout << "final: ";
cin >> student.final;
return student;
}
//displays a student's info.
//structure is passed by value
void print_stu (struct STU_GRADES stu)
{
cout << "nnnGrade report for: " << stu.name<<endl;
cout << "nexam 1texam 2texam 3tfinaln";
cout << stu.exam1 << "t" << stu.exam2 << "t"<< stu.exam3 << "t" << stu.final;
cout << "nnnsemester average: " << setiosflags (ios::fixed)<< setprecision (2) << stu.sem_ave;
cout << "nsemester grade: " << stu.letter_grade;
}
float calc_ave (int ex1, int ex2, int ex3, int final)
{
float ave;
ave = float (ex1 + ex2 + ex3 + final)/4.0f;
return ave;
}
char assign_let (float average)
{
char let_grade;
if (average >=90)
let_grade = 'A';
else if (average >= 80)
let_grade = 'B';
else if (average >= 70)
let_grade = 'C';
else if (average >= 60)
let_grade = 'D';
else
let_grade = 'F';
return let_grade;
}
int main()
{
struct S_Details stu;
char more;
do
{
//pass the entire structure
Stu = get_stu ( );
//pass elements of the strucutre
stu.sem_ave = calc_ave (stu.exam1, stu.exam2, stu.exam3, stu.final);
//pass elements of the structure
stu.letter_grade = assign_let (stu.sem_ave);
//pass the entire structure
print_stu (stu);
cout << "nnn Enter another student? (y/n) ";
cin >> more;
//grab the carriage return since
//character data is input next
cin.ignore ( );
}
while (more == 'y' || more == 'Y');
return 0;
}

More Related Content

Similar to Codes on structures

Tugas praktikukm pemrograman c++
Tugas praktikukm  pemrograman c++Tugas praktikukm  pemrograman c++
Tugas praktikukm pemrograman c++Dendi Riadi
 
Complete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdfComplete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdfaccess2future1
 
Students Management System c++ project.pptx
Students Management System c++ project.pptxStudents Management System c++ project.pptx
Students Management System c++ project.pptxqaswarsarfraz
 
Part APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docxPart APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docxdewhirstichabod
 
12. stl örnekler
12.  stl örnekler12.  stl örnekler
12. stl örneklerkarmuhtam
 
Start with the inclusion of libraries#include iostream .docx
 Start with the inclusion of libraries#include iostream .docx Start with the inclusion of libraries#include iostream .docx
Start with the inclusion of libraries#include iostream .docxMARRY7
 
include ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdfinclude ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdfcontact32
 
Assignment7.pdf
Assignment7.pdfAssignment7.pdf
Assignment7.pdfdash41
 
CCE management system
CCE management systemCCE management system
CCE management systemTrish004
 
Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)Syed Umair
 
Programming - Marla Fuentes
Programming - Marla FuentesProgramming - Marla Fuentes
Programming - Marla Fuentesmfuentessss
 

Similar to Codes on structures (20)

Tugas praktikukm pemrograman c++
Tugas praktikukm  pemrograman c++Tugas praktikukm  pemrograman c++
Tugas praktikukm pemrograman c++
 
C++ L07-Struct
C++ L07-StructC++ L07-Struct
C++ L07-Struct
 
CSNB244 Lab5
CSNB244 Lab5CSNB244 Lab5
CSNB244 Lab5
 
Complete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdfComplete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdf
 
C programs
C programsC programs
C programs
 
Students Management System c++ project.pptx
Students Management System c++ project.pptxStudents Management System c++ project.pptx
Students Management System c++ project.pptx
 
Part APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docxPart APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docx
 
C++ practical
C++ practicalC++ practical
C++ practical
 
12. stl örnekler
12.  stl örnekler12.  stl örnekler
12. stl örnekler
 
Start with the inclusion of libraries#include iostream .docx
 Start with the inclusion of libraries#include iostream .docx Start with the inclusion of libraries#include iostream .docx
Start with the inclusion of libraries#include iostream .docx
 
include ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdfinclude ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdf
 
Rabia
RabiaRabia
Rabia
 
Static and const members
Static and const membersStatic and const members
Static and const members
 
Assignment7.pdf
Assignment7.pdfAssignment7.pdf
Assignment7.pdf
 
CCE management system
CCE management systemCCE management system
CCE management system
 
Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)
 
Es6 hackathon
Es6 hackathonEs6 hackathon
Es6 hackathon
 
Project in programming
Project in programmingProject in programming
Project in programming
 
Algoritma 5 november wiwik p.l
Algoritma 5 november wiwik p.lAlgoritma 5 november wiwik p.l
Algoritma 5 november wiwik p.l
 
Programming - Marla Fuentes
Programming - Marla FuentesProgramming - Marla Fuentes
Programming - Marla Fuentes
 

More from Shakila Mahjabin (15)

Computer processing
Computer processingComputer processing
Computer processing
 
Arrays in CPP
Arrays in CPPArrays in CPP
Arrays in CPP
 
CSC 433 Sample normalization SQL Question
CSC 433 Sample normalization SQL QuestionCSC 433 Sample normalization SQL Question
CSC 433 Sample normalization SQL Question
 
SQL : introduction
SQL : introductionSQL : introduction
SQL : introduction
 
Normalization
NormalizationNormalization
Normalization
 
Solution of Erds
Solution of ErdsSolution of Erds
Solution of Erds
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Ch1- Introduction to dbms
Ch1- Introduction to dbmsCh1- Introduction to dbms
Ch1- Introduction to dbms
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Algo analysis
Algo analysisAlgo analysis
Algo analysis
 
Merge sort and quick sort
Merge sort and quick sortMerge sort and quick sort
Merge sort and quick sort
 
Arrays
ArraysArrays
Arrays
 
array, function, pointer, pattern matching
array, function, pointer, pattern matchingarray, function, pointer, pattern matching
array, function, pointer, pattern matching
 
String operation
String operationString operation
String operation
 
Data Structure Basics
Data Structure BasicsData Structure Basics
Data Structure Basics
 

Recently uploaded

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 

Recently uploaded (20)

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 

Codes on structures

  • 1. 1. #include <iostream.h> #include <conio.h> #include <iomanip.h> struct student { int ID; // 4 bytes char name[10];//10bytes float grade; // 4bytes int age; // 4 char phone[10]; // 10 char e_mail[16]; // 16 }; void display(struct student s) { cout<<setw(3)<< s.ID <<setw(12)<< s.name <<setw(8)<< setiosflags (ios::showpoint)<<setprecision(2)<< s.grade<<setw(5)<<s.age <<setw(10)<< s.phone<< setw(18)<<s.e_mail<<endl; } void main() { struct student s1={55,"Amir Ali",3.5f,23,"6535418","amir@yahoo.com"}; struct student s2={26,"Mujahid",2.9888f,25,"5362169", "muj@hotmail.com"}; struct student s3={39,"M Jamil",3.108f,30,"2345677","jam@hotmail.com"}; struct student s4={44,"Dilawar",2.7866f,31,"5432186","dil@hotmail.com"}; struct student s5={59,"S.Naveed",2.9f,27,"2345671","navee@yahoo.com"}; cout<<" Students Records Sheetn"; cout<<" ~~~~~~~~~~~~~~~~~~~~~~nn"; cout<<"ID# NAME GRADE AGE PHONE E-MAILn"; cout<<"~~~ ~~~~ ~~~~~ ~~~ ~~~~~ ~~~~~~~n"; display(s1); // structure pass to function display(s2); // structure pass to function display(s3); display(s4); display(s5); } 2. // In this program you will see the structures (members Manipulation), // Passing structures to functions: #include <iostream.h> #include <iomanip.h> struct S_Details { char name [30];
  • 2. int exam1; int exam2; int exam3; int final; float sem_ave; char letter_grade; }; //inputs the data items for a student, structure //is passed by reference struct S_Details get_stu ( ) { struct STU_GRADES student; cout << "nnnn Enter the information for a studentn"; cout << " Name: "; cin.getline (student.name, 30, 'n'); cout << " Exam1: "; cin >> student.exam1; cout << " Exam2: "; cin >> student.exam2; cout << "exam3: "; cin >> student.exam3; cout << "final: "; cin >> student.final; return student; } //displays a student's info. //structure is passed by value void print_stu (struct STU_GRADES stu) { cout << "nnnGrade report for: " << stu.name<<endl; cout << "nexam 1texam 2texam 3tfinaln"; cout << stu.exam1 << "t" << stu.exam2 << "t"<< stu.exam3 << "t" << stu.final; cout << "nnnsemester average: " << setiosflags (ios::fixed)<< setprecision (2) << stu.sem_ave; cout << "nsemester grade: " << stu.letter_grade; } float calc_ave (int ex1, int ex2, int ex3, int final) { float ave; ave = float (ex1 + ex2 + ex3 + final)/4.0f; return ave; } char assign_let (float average) {
  • 3. char let_grade; if (average >=90) let_grade = 'A'; else if (average >= 80) let_grade = 'B'; else if (average >= 70) let_grade = 'C'; else if (average >= 60) let_grade = 'D'; else let_grade = 'F'; return let_grade; } int main() { struct S_Details stu; char more; do { //pass the entire structure Stu = get_stu ( ); //pass elements of the strucutre stu.sem_ave = calc_ave (stu.exam1, stu.exam2, stu.exam3, stu.final); //pass elements of the structure stu.letter_grade = assign_let (stu.sem_ave); //pass the entire structure print_stu (stu); cout << "nnn Enter another student? (y/n) "; cin >> more; //grab the carriage return since //character data is input next cin.ignore ( ); } while (more == 'y' || more == 'Y'); return 0; }