SlideShare a Scribd company logo
C++ PROGRAM
This program builds on the code below:
#include
#include
#include "shirtType.h"
using namespace std;
void getInput(shirtType s[],ifstream& infile, int& numShirts);
int main()
{
int numShirts;
shirtType shirts[500];
ifstream infile;
infile.open("h:shirtlab.txt");
getInput(shirts,infile,numShirts);
for(int i =0; i>id;
infile.ignore(100,' ');
getline(infile,c);
infile>>size>>p>>q;
while(infile)
{
s[index].setAll(id, c, size, p, q);
index++;
infile>>id;
infile.ignore(100,' ');
getline(infile,c);
infile>>size>>p>>q;
}
numShirts=index;
}
See also the description of the class shirtType below:
#include
#include
using namespace std;
class shirtType
{
private:
int shirtID;
string color;
string size;
double price;
int quantity;
public:
void setAll(int i,string c,string s, double p, int q);
void print() const;
void newQuan();
shirtType();
shirtType(int,string,string,double,int);
};
shirtType::shirtType(int i,string c,string s, double p, int q)
{
color = c;
size = s;
if(i>0)
shirtID=i;
else
shirtID=0;
if(p>0.0)
price = p;
else
price=0.0;
if (q>=0)
quantity=q;
else
quantity = 0;
}
shirtType::shirtType()
{
shirtID=0;
color="";
size="";
price=0.0;
quantity=0;
}
void shirtType::setAll(int i,string c,string s, double p, int q)
{
color = c;
size = s;
if(i>0)
shirtID=i;
else
shirtID=0;
if(p>0.0)
price = p;
else
price=0.0;
if (q>=0)
quantity=q;
else
quantity = 0;
}
void shirtType::newQuan()
{
cout<<"Enter the new quantity of shirts: "<>quantity;
}
void shirtType::print() const
{
cout<<"Shirt ID: "<
Solution
#include
#include
struct node
{
int data;
struct node *next;
}*head;
void append(int nkkm)
{
struct node *temp,*right;
temp= (struct node *)malloc(sizeof(struct node));
temp->data=nkkm;
right=(struct node *)head;
while(right->next != NULL)
right=right->next;
right->next =temp;
right=temp;
right->next=NULL;
}
void add( int nkkm )
{
struct node *temp;
temp=(struct node *)malloc(sizeof(struct node));
temp->data=nkkm;
if (head== NULL)
{
head=temp;
head->next=NULL;
}
else
{
temp->next=head;
head=temp;
}
}
void addafter(int nkkm, int loc)
{
int i;
struct node *temp,*left,*right;
right=head;
for(i=1;inext;
}
temp=(struct node *)malloc(sizeof(struct node));
temp->data=nkkm;
left->next=temp;
left=temp;
left->next=right;
return;
}
void addaShirt(int nkkm)
{
int c=0;
struct node *temp;
temp=head;
if(temp==NULL)
{
add(nkkm);
}
else
{
while(temp!=NULL)
{
if(temp->datanext;
}
if(c==0)
add(nkkm);
else if(cdata==nkkm)
{
if(temp==head)
{
head=temp->next;
free(temp);
return 1;
}
else
{
prev->next=temp->next;
free(temp);
return 1;
}
}
else
{
prev=temp;
temp= temp->next;
}
}
return 0;
}
void display(struct node *r)
{
r=head;
if(r==NULL)
{
return;
}
while(r!=NULL)
{
printf("%d ",r->data);
r=r->next;
}
printf(" ");
}
int count()
{
struct node *n;
int c=0;
n=head;
while(n!=NULL)
{
n=n->next;
c++;
}
return c;
}
int main()
{
int i,nkkm;
struct node *n;
head=NULL;
while(1)
{
printf("1.Add a shirt ");
printf("2.Sell a shirt ");
printf("3.Restock a shirt ");
printf("4.Print a list of all shirts  ");
printf("5.Quit ");
printf("Enter your choice : ");
if(scanf("%d",&i)<=0){
printf("Enter only an Integer ");
exit(0);
} else {
switch(i)
{
case 1: printf("Enter the number to addaShirt : ");
scanf("%d",&nkkm);
addaShirt(nkkm);
break;
case 2: if(head==NULL)
{
printf("List is Empty ");
}
else
{
printf("Element(s) in the list are : ");
}
display(n);
break;
case 3: printf("Size of the list is %d ",count());
break;
case 4: if(head==NULL)
printf("List is Empty ");
else{
printf("Enter the number to delete : ");
scanf("%d",&nkkm);
if(delete(nkkm))
printf("%d deleted successfully ",nkkm);
else
printf("%d not found in the list ",nkkm);
}
break;
case 5: return 0;
default: printf("Invalid option ");
}
}
}
return 0;
}

More Related Content

Similar to C++ PROGRAMThis program builds on the code below#include iostr.pdf

DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
Prof. Dr. K. Adisesha
 
C programming
C programmingC programming
C programming
Samsil Arefin
 
Aplikasi menghitung matematika dengan c++
Aplikasi menghitung matematika dengan c++Aplikasi menghitung matematika dengan c++
Aplikasi menghitung matematika dengan c++
radar radius
 
C programming codes for the class assignment
C programming codes for the class assignmentC programming codes for the class assignment
C programming codes for the class assignment
Zenith SVG
 
C programms
C programmsC programms
C programms
Mukund Gandrakota
 
C Programming Lab.pdf
C Programming Lab.pdfC Programming Lab.pdf
C Programming Lab.pdf
MOJO89
 
RAILWAY RESERWATION PROJECT PROGRAM
RAILWAY RESERWATION PROJECT PROGRAMRAILWAY RESERWATION PROJECT PROGRAM
RAILWAY RESERWATION PROJECT PROGRAM
Krishna Raj
 
C-Program Custom Library, Header File, and Implementation FilesI .pdf
C-Program Custom Library, Header File, and Implementation FilesI .pdfC-Program Custom Library, Header File, and Implementation FilesI .pdf
C-Program Custom Library, Header File, and Implementation FilesI .pdf
herminaherman
 
C faq pdf
C faq pdfC faq pdf
C faq pdf
DebiPanda
 
Railway reservation
Railway reservationRailway reservation
Railway reservation
Swarup Boro
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservation
Swarup Kumar Boro
 
4. chapter iii
4. chapter iii4. chapter iii
4. chapter iii
Chhom Karath
 
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdf#include stdio.h#include stdlib.h#include string.h#inclu.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
apleather
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 
Twitter sentiment analysis for cryptoassets
Twitter sentiment analysis for cryptoassets Twitter sentiment analysis for cryptoassets
Twitter sentiment analysis for cryptoassets
Mamoon Ismail Khalid
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
Ashwin Francis
 
Cd practical file (1) start se
Cd practical file (1) start seCd practical file (1) start se
Cd practical file (1) start se
dalipkumar64
 
SaraPIC
SaraPICSaraPIC
SaraPIC
Sara Sahu
 
Railwaynew
RailwaynewRailwaynew
Railwaynew
Arsh Vishwakarma
 
Pnno
PnnoPnno

Similar to C++ PROGRAMThis program builds on the code below#include iostr.pdf (20)

DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
 
C programming
C programmingC programming
C programming
 
Aplikasi menghitung matematika dengan c++
Aplikasi menghitung matematika dengan c++Aplikasi menghitung matematika dengan c++
Aplikasi menghitung matematika dengan c++
 
C programming codes for the class assignment
C programming codes for the class assignmentC programming codes for the class assignment
C programming codes for the class assignment
 
C programms
C programmsC programms
C programms
 
C Programming Lab.pdf
C Programming Lab.pdfC Programming Lab.pdf
C Programming Lab.pdf
 
RAILWAY RESERWATION PROJECT PROGRAM
RAILWAY RESERWATION PROJECT PROGRAMRAILWAY RESERWATION PROJECT PROGRAM
RAILWAY RESERWATION PROJECT PROGRAM
 
C-Program Custom Library, Header File, and Implementation FilesI .pdf
C-Program Custom Library, Header File, and Implementation FilesI .pdfC-Program Custom Library, Header File, and Implementation FilesI .pdf
C-Program Custom Library, Header File, and Implementation FilesI .pdf
 
C faq pdf
C faq pdfC faq pdf
C faq pdf
 
Railway reservation
Railway reservationRailway reservation
Railway reservation
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservation
 
4. chapter iii
4. chapter iii4. chapter iii
4. chapter iii
 
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdf#include stdio.h#include stdlib.h#include string.h#inclu.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
Twitter sentiment analysis for cryptoassets
Twitter sentiment analysis for cryptoassets Twitter sentiment analysis for cryptoassets
Twitter sentiment analysis for cryptoassets
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
Cd practical file (1) start se
Cd practical file (1) start seCd practical file (1) start se
Cd practical file (1) start se
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
Railwaynew
RailwaynewRailwaynew
Railwaynew
 
Pnno
PnnoPnno
Pnno
 

More from irshadoptical

In practice, a RAM is used to simulate the operation of a stack by m.pdf
In practice, a RAM is used to simulate the operation of a stack by m.pdfIn practice, a RAM is used to simulate the operation of a stack by m.pdf
In practice, a RAM is used to simulate the operation of a stack by m.pdf
irshadoptical
 
i need help to edit the two methods below so that i can have them wo.pdf
i need help to edit the two methods below so that i can have them wo.pdfi need help to edit the two methods below so that i can have them wo.pdf
i need help to edit the two methods below so that i can have them wo.pdf
irshadoptical
 
Help!! Which of the following correctly lists the simple molecules t.pdf
Help!! Which of the following correctly lists the simple molecules t.pdfHelp!! Which of the following correctly lists the simple molecules t.pdf
Help!! Which of the following correctly lists the simple molecules t.pdf
irshadoptical
 
How does feasibility differ in an agile environment in comparison to.pdf
How does feasibility differ in an agile environment in comparison to.pdfHow does feasibility differ in an agile environment in comparison to.pdf
How does feasibility differ in an agile environment in comparison to.pdf
irshadoptical
 
describe a real-life example of selection against a homozygous reces.pdf
describe a real-life example of selection against a homozygous reces.pdfdescribe a real-life example of selection against a homozygous reces.pdf
describe a real-life example of selection against a homozygous reces.pdf
irshadoptical
 
Define a motor unit. What roles do motor units play in graded contrac.pdf
Define a motor unit. What roles do motor units play in graded contrac.pdfDefine a motor unit. What roles do motor units play in graded contrac.pdf
Define a motor unit. What roles do motor units play in graded contrac.pdf
irshadoptical
 
An antibody is a protein that has which level of protein structure .pdf
An antibody is a protein that has which level of protein structure  .pdfAn antibody is a protein that has which level of protein structure  .pdf
An antibody is a protein that has which level of protein structure .pdf
irshadoptical
 
You are in charge of the investigation regarding possible exposur.pdf
You are in charge of the investigation regarding possible exposur.pdfYou are in charge of the investigation regarding possible exposur.pdf
You are in charge of the investigation regarding possible exposur.pdf
irshadoptical
 
Which of the following is not a product of the light reactions of ph.pdf
Which of the following is not a product of the light reactions of ph.pdfWhich of the following is not a product of the light reactions of ph.pdf
Which of the following is not a product of the light reactions of ph.pdf
irshadoptical
 
Write a line of code to create a Print Writer to write to the file .pdf
Write a line of code to create a Print Writer to write to the file .pdfWrite a line of code to create a Print Writer to write to the file .pdf
Write a line of code to create a Print Writer to write to the file .pdf
irshadoptical
 
what is the difference bettween cotranslational import and posttrans.pdf
what is the difference bettween cotranslational import and posttrans.pdfwhat is the difference bettween cotranslational import and posttrans.pdf
what is the difference bettween cotranslational import and posttrans.pdf
irshadoptical
 
What is the meaning of critical periods in neonatal development Wha.pdf
What is the meaning of critical periods in neonatal development Wha.pdfWhat is the meaning of critical periods in neonatal development Wha.pdf
What is the meaning of critical periods in neonatal development Wha.pdf
irshadoptical
 
What are the major differences between foreign bonds and Eurobonds .pdf
What are the major differences between foreign bonds and Eurobonds .pdfWhat are the major differences between foreign bonds and Eurobonds .pdf
What are the major differences between foreign bonds and Eurobonds .pdf
irshadoptical
 
What is meant by ecological fallacySolutionAnswerThe term .pdf
What is meant by ecological fallacySolutionAnswerThe term .pdfWhat is meant by ecological fallacySolutionAnswerThe term .pdf
What is meant by ecological fallacySolutionAnswerThe term .pdf
irshadoptical
 
What are the two main branches of Non-Euclidean Geometry What is the.pdf
What are the two main branches of Non-Euclidean Geometry What is the.pdfWhat are the two main branches of Non-Euclidean Geometry What is the.pdf
What are the two main branches of Non-Euclidean Geometry What is the.pdf
irshadoptical
 
By what transport method does oxygen enter the blood from the alveol.pdf
By what transport method does oxygen enter the blood from the alveol.pdfBy what transport method does oxygen enter the blood from the alveol.pdf
By what transport method does oxygen enter the blood from the alveol.pdf
irshadoptical
 
All of these are examples of evidence used to support the hypothesis.pdf
All of these are examples of evidence used to support the hypothesis.pdfAll of these are examples of evidence used to support the hypothesis.pdf
All of these are examples of evidence used to support the hypothesis.pdf
irshadoptical
 
A 28 year-old biologist makes a trip to study life forms in a distan.pdf
A 28 year-old biologist makes a trip to study life forms in a distan.pdfA 28 year-old biologist makes a trip to study life forms in a distan.pdf
A 28 year-old biologist makes a trip to study life forms in a distan.pdf
irshadoptical
 
4. Name the following compounds CO2 CH CH3 CH20H CH3COOH 5. Water ha.pdf
4. Name the following compounds CO2 CH CH3 CH20H CH3COOH 5. Water ha.pdf4. Name the following compounds CO2 CH CH3 CH20H CH3COOH 5. Water ha.pdf
4. Name the following compounds CO2 CH CH3 CH20H CH3COOH 5. Water ha.pdf
irshadoptical
 
4. When examining whether group differences occur on more than one d.pdf
4. When examining whether group differences occur on more than one d.pdf4. When examining whether group differences occur on more than one d.pdf
4. When examining whether group differences occur on more than one d.pdf
irshadoptical
 

More from irshadoptical (20)

In practice, a RAM is used to simulate the operation of a stack by m.pdf
In practice, a RAM is used to simulate the operation of a stack by m.pdfIn practice, a RAM is used to simulate the operation of a stack by m.pdf
In practice, a RAM is used to simulate the operation of a stack by m.pdf
 
i need help to edit the two methods below so that i can have them wo.pdf
i need help to edit the two methods below so that i can have them wo.pdfi need help to edit the two methods below so that i can have them wo.pdf
i need help to edit the two methods below so that i can have them wo.pdf
 
Help!! Which of the following correctly lists the simple molecules t.pdf
Help!! Which of the following correctly lists the simple molecules t.pdfHelp!! Which of the following correctly lists the simple molecules t.pdf
Help!! Which of the following correctly lists the simple molecules t.pdf
 
How does feasibility differ in an agile environment in comparison to.pdf
How does feasibility differ in an agile environment in comparison to.pdfHow does feasibility differ in an agile environment in comparison to.pdf
How does feasibility differ in an agile environment in comparison to.pdf
 
describe a real-life example of selection against a homozygous reces.pdf
describe a real-life example of selection against a homozygous reces.pdfdescribe a real-life example of selection against a homozygous reces.pdf
describe a real-life example of selection against a homozygous reces.pdf
 
Define a motor unit. What roles do motor units play in graded contrac.pdf
Define a motor unit. What roles do motor units play in graded contrac.pdfDefine a motor unit. What roles do motor units play in graded contrac.pdf
Define a motor unit. What roles do motor units play in graded contrac.pdf
 
An antibody is a protein that has which level of protein structure .pdf
An antibody is a protein that has which level of protein structure  .pdfAn antibody is a protein that has which level of protein structure  .pdf
An antibody is a protein that has which level of protein structure .pdf
 
You are in charge of the investigation regarding possible exposur.pdf
You are in charge of the investigation regarding possible exposur.pdfYou are in charge of the investigation regarding possible exposur.pdf
You are in charge of the investigation regarding possible exposur.pdf
 
Which of the following is not a product of the light reactions of ph.pdf
Which of the following is not a product of the light reactions of ph.pdfWhich of the following is not a product of the light reactions of ph.pdf
Which of the following is not a product of the light reactions of ph.pdf
 
Write a line of code to create a Print Writer to write to the file .pdf
Write a line of code to create a Print Writer to write to the file .pdfWrite a line of code to create a Print Writer to write to the file .pdf
Write a line of code to create a Print Writer to write to the file .pdf
 
what is the difference bettween cotranslational import and posttrans.pdf
what is the difference bettween cotranslational import and posttrans.pdfwhat is the difference bettween cotranslational import and posttrans.pdf
what is the difference bettween cotranslational import and posttrans.pdf
 
What is the meaning of critical periods in neonatal development Wha.pdf
What is the meaning of critical periods in neonatal development Wha.pdfWhat is the meaning of critical periods in neonatal development Wha.pdf
What is the meaning of critical periods in neonatal development Wha.pdf
 
What are the major differences between foreign bonds and Eurobonds .pdf
What are the major differences between foreign bonds and Eurobonds .pdfWhat are the major differences between foreign bonds and Eurobonds .pdf
What are the major differences between foreign bonds and Eurobonds .pdf
 
What is meant by ecological fallacySolutionAnswerThe term .pdf
What is meant by ecological fallacySolutionAnswerThe term .pdfWhat is meant by ecological fallacySolutionAnswerThe term .pdf
What is meant by ecological fallacySolutionAnswerThe term .pdf
 
What are the two main branches of Non-Euclidean Geometry What is the.pdf
What are the two main branches of Non-Euclidean Geometry What is the.pdfWhat are the two main branches of Non-Euclidean Geometry What is the.pdf
What are the two main branches of Non-Euclidean Geometry What is the.pdf
 
By what transport method does oxygen enter the blood from the alveol.pdf
By what transport method does oxygen enter the blood from the alveol.pdfBy what transport method does oxygen enter the blood from the alveol.pdf
By what transport method does oxygen enter the blood from the alveol.pdf
 
All of these are examples of evidence used to support the hypothesis.pdf
All of these are examples of evidence used to support the hypothesis.pdfAll of these are examples of evidence used to support the hypothesis.pdf
All of these are examples of evidence used to support the hypothesis.pdf
 
A 28 year-old biologist makes a trip to study life forms in a distan.pdf
A 28 year-old biologist makes a trip to study life forms in a distan.pdfA 28 year-old biologist makes a trip to study life forms in a distan.pdf
A 28 year-old biologist makes a trip to study life forms in a distan.pdf
 
4. Name the following compounds CO2 CH CH3 CH20H CH3COOH 5. Water ha.pdf
4. Name the following compounds CO2 CH CH3 CH20H CH3COOH 5. Water ha.pdf4. Name the following compounds CO2 CH CH3 CH20H CH3COOH 5. Water ha.pdf
4. Name the following compounds CO2 CH CH3 CH20H CH3COOH 5. Water ha.pdf
 
4. When examining whether group differences occur on more than one d.pdf
4. When examining whether group differences occur on more than one d.pdf4. When examining whether group differences occur on more than one d.pdf
4. When examining whether group differences occur on more than one d.pdf
 

Recently uploaded

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 

Recently uploaded (20)

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 

C++ PROGRAMThis program builds on the code below#include iostr.pdf

  • 1. C++ PROGRAM This program builds on the code below: #include #include #include "shirtType.h" using namespace std; void getInput(shirtType s[],ifstream& infile, int& numShirts); int main() { int numShirts; shirtType shirts[500]; ifstream infile; infile.open("h:shirtlab.txt"); getInput(shirts,infile,numShirts); for(int i =0; i>id; infile.ignore(100,' '); getline(infile,c); infile>>size>>p>>q; while(infile) { s[index].setAll(id, c, size, p, q); index++; infile>>id; infile.ignore(100,' '); getline(infile,c); infile>>size>>p>>q; } numShirts=index; } See also the description of the class shirtType below: #include #include using namespace std; class shirtType
  • 2. { private: int shirtID; string color; string size; double price; int quantity; public: void setAll(int i,string c,string s, double p, int q); void print() const; void newQuan(); shirtType(); shirtType(int,string,string,double,int); }; shirtType::shirtType(int i,string c,string s, double p, int q) { color = c; size = s; if(i>0) shirtID=i; else shirtID=0; if(p>0.0) price = p; else price=0.0; if (q>=0) quantity=q; else quantity = 0; } shirtType::shirtType() {
  • 3. shirtID=0; color=""; size=""; price=0.0; quantity=0; } void shirtType::setAll(int i,string c,string s, double p, int q) { color = c; size = s; if(i>0) shirtID=i; else shirtID=0; if(p>0.0) price = p; else price=0.0; if (q>=0) quantity=q; else quantity = 0; } void shirtType::newQuan() { cout<<"Enter the new quantity of shirts: "<>quantity; } void shirtType::print() const { cout<<"Shirt ID: "< Solution #include #include
  • 4. struct node { int data; struct node *next; }*head; void append(int nkkm) { struct node *temp,*right; temp= (struct node *)malloc(sizeof(struct node)); temp->data=nkkm; right=(struct node *)head; while(right->next != NULL) right=right->next; right->next =temp; right=temp; right->next=NULL; } void add( int nkkm ) { struct node *temp; temp=(struct node *)malloc(sizeof(struct node)); temp->data=nkkm; if (head== NULL) { head=temp; head->next=NULL; } else {
  • 5. temp->next=head; head=temp; } } void addafter(int nkkm, int loc) { int i; struct node *temp,*left,*right; right=head; for(i=1;inext; } temp=(struct node *)malloc(sizeof(struct node)); temp->data=nkkm; left->next=temp; left=temp; left->next=right; return; } void addaShirt(int nkkm) { int c=0; struct node *temp; temp=head; if(temp==NULL) { add(nkkm); } else { while(temp!=NULL) { if(temp->datanext; }
  • 6. if(c==0) add(nkkm); else if(cdata==nkkm) { if(temp==head) { head=temp->next; free(temp); return 1; } else { prev->next=temp->next; free(temp); return 1; } } else { prev=temp; temp= temp->next; } } return 0; } void display(struct node *r) { r=head; if(r==NULL) { return; } while(r!=NULL) {
  • 7. printf("%d ",r->data); r=r->next; } printf(" "); } int count() { struct node *n; int c=0; n=head; while(n!=NULL) { n=n->next; c++; } return c; } int main() { int i,nkkm; struct node *n; head=NULL; while(1) { printf("1.Add a shirt "); printf("2.Sell a shirt "); printf("3.Restock a shirt "); printf("4.Print a list of all shirts "); printf("5.Quit "); printf("Enter your choice : "); if(scanf("%d",&i)<=0){
  • 8. printf("Enter only an Integer "); exit(0); } else { switch(i) { case 1: printf("Enter the number to addaShirt : "); scanf("%d",&nkkm); addaShirt(nkkm); break; case 2: if(head==NULL) { printf("List is Empty "); } else { printf("Element(s) in the list are : "); } display(n); break; case 3: printf("Size of the list is %d ",count()); break; case 4: if(head==NULL) printf("List is Empty "); else{ printf("Enter the number to delete : "); scanf("%d",&nkkm); if(delete(nkkm)) printf("%d deleted successfully ",nkkm); else printf("%d not found in the list ",nkkm); } break; case 5: return 0; default: printf("Invalid option "); } }