SlideShare a Scribd company logo
#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
//shirtType.h
#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();
int changeQuan();
int getShirtId(int);
shirtType();
int search(int);
shirtType(int,string,string,double,int);
};
int shirtType::search(int sellId)
{
if(shirtID == sellId)
return 1;
else
return 0;
}
int shirtType::getShirtId(int i)
{
return shirtID;
}
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()
{
int q;
cout<<"Enter the new quantity of shirts: "<>q;
quantity += q;
}
int shirtType::changeQuan()
{
if(quantity > 0 )
{
quantity -= 1;
return 1;
}
{
return 2;
}
}
void shirtType::print() const
{
cout<<"Shirt ID: "<
#include
#include
#include "shirtType.h"
#include
using namespace std;
void getInput(shirtType s[],ifstream& infile, int& numShirts);
void addShirt(shirtType s[], int& numShirts);
void sellShirt(shirtType s[], int& numShirts);
void addstockShirt(shirtType s[], int& numShirts);
int main()
{
int numShirts;
char ch;
shirtType shirts[500];
ifstream infile;
infile.open("shirtlab.txt");
getInput(shirts,infile,numShirts);
// cout<>ch;
do{
switch(ch)
{
case 'a':
addShirt(shirts,numShirts);
break;
case 's':
sellShirt(shirts,numShirts);
break;
case 'r':
addstockShirt(shirts,numShirts);
break;
case 'p':
for(int i =0; i>ch;
}while(ch!='q');
infile.close();
return 0;
}
void getInput(shirtType s[], ifstream& infile, int& numShirts)
{
int id, q,index=0;
string c,size;
double p;
infile>>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;
}
void addShirt(shirtType s[], int& numShirts)
{
int id, q,index=numShirts;
// cout<>id;
cout<<" Shirt Color:";
cin>>c;
// getline(cin,c);
cout<<" Shirt size price and quantity:";
cin>>size>>p>>q;
s[index].setAll(id, c, size, p, q);
index++;
numShirts=index;
// cout<>sellId;
for(i =0; i>stockId;
for(i =0; i

More Related Content

Similar to #include iostream #include fstream #include shirtType.h.pdf

Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdfUsing standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
fashiongallery1
 
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
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdf
Ashutoshprasad27
 
PCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxPCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docx
Ashutoshprasad27
 
Array
ArrayArray
include ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdfinclude ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdf
adisainternational
 
Array of objects.pptx
Array of objects.pptxArray of objects.pptx
Array of objects.pptx
RAGAVIC2
 
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
 
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 reservationSwarup Kumar Boro
 
Array.ppt
Array.pptArray.ppt
Array.ppt
Array.pptArray.ppt
RAILWAY RESERWATION PROJECT PROGRAM
RAILWAY RESERWATION PROJECT PROGRAMRAILWAY RESERWATION PROJECT PROGRAM
RAILWAY RESERWATION PROJECT PROGRAM
Krishna Raj
 
Artdm170 Week10 Arrays Math
Artdm170 Week10 Arrays MathArtdm170 Week10 Arrays Math
Artdm170 Week10 Arrays MathGilbert Guerrero
 
ARTDM 170, Week10: Arrays + Using Randomization
ARTDM 170, Week10: Arrays + Using RandomizationARTDM 170, Week10: Arrays + Using Randomization
ARTDM 170, Week10: Arrays + Using RandomizationGilbert Guerrero
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
Mitul Patel
 
Array and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptxArray and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptx
JumanneChiyanda
 

Similar to #include iostream #include fstream #include shirtType.h.pdf (18)

Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdfUsing standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
 
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
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdf
 
PCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxPCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docx
 
Array
ArrayArray
Array
 
include ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdfinclude ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdf
 
Array of objects.pptx
Array of objects.pptxArray of objects.pptx
Array of objects.pptx
 
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++
 
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
 
Array.ppt
Array.pptArray.ppt
Array.ppt
 
Array.ppt
Array.pptArray.ppt
Array.ppt
 
RAILWAY RESERWATION PROJECT PROGRAM
RAILWAY RESERWATION PROJECT PROGRAMRAILWAY RESERWATION PROJECT PROGRAM
RAILWAY RESERWATION PROJECT PROGRAM
 
Artdm170 Week10 Arrays Math
Artdm170 Week10 Arrays MathArtdm170 Week10 Arrays Math
Artdm170 Week10 Arrays Math
 
ARTDM 170, Week10: Arrays + Using Randomization
ARTDM 170, Week10: Arrays + Using RandomizationARTDM 170, Week10: Arrays + Using Randomization
ARTDM 170, Week10: Arrays + Using Randomization
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
 
Array and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptxArray and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptx
 

More from arihantpatna

Compare and contrast the advantages and disadvantages of arrays and .pdf
Compare and contrast the advantages and disadvantages of arrays and .pdfCompare and contrast the advantages and disadvantages of arrays and .pdf
Compare and contrast the advantages and disadvantages of arrays and .pdf
arihantpatna
 
Answer and describe the following five plants habit, habitat, life .pdf
Answer and describe the following five plants habit, habitat, life .pdfAnswer and describe the following five plants habit, habitat, life .pdf
Answer and describe the following five plants habit, habitat, life .pdf
arihantpatna
 
A plant has the genotype (Aa; Bb; Cc). How many different genotype.pdf
A plant has the genotype (Aa; Bb; Cc). How many different genotype.pdfA plant has the genotype (Aa; Bb; Cc). How many different genotype.pdf
A plant has the genotype (Aa; Bb; Cc). How many different genotype.pdf
arihantpatna
 
A) Explain how bilateral symmetry contributed to motion and cephaliz.pdf
A) Explain how bilateral symmetry contributed to motion and cephaliz.pdfA) Explain how bilateral symmetry contributed to motion and cephaliz.pdf
A) Explain how bilateral symmetry contributed to motion and cephaliz.pdf
arihantpatna
 
_______ are any substances that when introduced into the body, stimul.pdf
_______ are any substances that when introduced into the body, stimul.pdf_______ are any substances that when introduced into the body, stimul.pdf
_______ are any substances that when introduced into the body, stimul.pdf
arihantpatna
 
You decide to spend Break hiking through the Rockies upon arrival, yo.pdf
You decide to spend Break hiking through the Rockies upon arrival, yo.pdfYou decide to spend Break hiking through the Rockies upon arrival, yo.pdf
You decide to spend Break hiking through the Rockies upon arrival, yo.pdf
arihantpatna
 
Write a program in Java that reads a set of doubles from a file, sto.pdf
Write a program in Java that reads a set of doubles from a file, sto.pdfWrite a program in Java that reads a set of doubles from a file, sto.pdf
Write a program in Java that reads a set of doubles from a file, sto.pdf
arihantpatna
 
Which of the following statements is true about cultureA. Culture.pdf
Which of the following statements is true about cultureA. Culture.pdfWhich of the following statements is true about cultureA. Culture.pdf
Which of the following statements is true about cultureA. Culture.pdf
arihantpatna
 
Which data set has the least sample standard deviation Data set (ii.pdf
Which data set has the least sample standard deviation  Data set (ii.pdfWhich data set has the least sample standard deviation  Data set (ii.pdf
Which data set has the least sample standard deviation Data set (ii.pdf
arihantpatna
 
Whats wrong with this Hardy Weinberg question I thought it was a.pdf
Whats wrong with this Hardy Weinberg question I thought it was a.pdfWhats wrong with this Hardy Weinberg question I thought it was a.pdf
Whats wrong with this Hardy Weinberg question I thought it was a.pdf
arihantpatna
 
6. List and define the underlying conditions, or assumptions, which .pdf
6. List and define the underlying conditions, or assumptions, which .pdf6. List and define the underlying conditions, or assumptions, which .pdf
6. List and define the underlying conditions, or assumptions, which .pdf
arihantpatna
 
What does the LP tableau below indicate (The xs are decision varia.pdf
What does the LP tableau below indicate (The xs are decision varia.pdfWhat does the LP tableau below indicate (The xs are decision varia.pdf
What does the LP tableau below indicate (The xs are decision varia.pdf
arihantpatna
 
Wha is the difference between the large intestine and colon .pdf
Wha is the difference between the large intestine and colon .pdfWha is the difference between the large intestine and colon .pdf
Wha is the difference between the large intestine and colon .pdf
arihantpatna
 
Was airpower decisive in winning World War II Defend your answer..pdf
Was airpower decisive in winning World War II Defend your answer..pdfWas airpower decisive in winning World War II Defend your answer..pdf
Was airpower decisive in winning World War II Defend your answer..pdf
arihantpatna
 
Summarize the workflow of the study of microbial diversity. Draw a d.pdf
Summarize the workflow of the study of microbial diversity. Draw a d.pdfSummarize the workflow of the study of microbial diversity. Draw a d.pdf
Summarize the workflow of the study of microbial diversity. Draw a d.pdf
arihantpatna
 
Shifting allocations most often arise as a result of which of the fo.pdf
Shifting allocations most often arise as a result of which of the fo.pdfShifting allocations most often arise as a result of which of the fo.pdf
Shifting allocations most often arise as a result of which of the fo.pdf
arihantpatna
 
16.) How would you determine if Cellulous is hydrophobic or hydrophi.pdf
16.) How would you determine if Cellulous is hydrophobic or hydrophi.pdf16.) How would you determine if Cellulous is hydrophobic or hydrophi.pdf
16.) How would you determine if Cellulous is hydrophobic or hydrophi.pdf
arihantpatna
 
Please Explain CompletelyWhat defines the beginning of the hepatic.pdf
Please Explain CompletelyWhat defines the beginning of the hepatic.pdfPlease Explain CompletelyWhat defines the beginning of the hepatic.pdf
Please Explain CompletelyWhat defines the beginning of the hepatic.pdf
arihantpatna
 
Plant Diversity II –     Seed Plants1. Explain how the rise in pro.pdf
Plant Diversity II –     Seed Plants1. Explain how the rise in pro.pdfPlant Diversity II –     Seed Plants1. Explain how the rise in pro.pdf
Plant Diversity II –     Seed Plants1. Explain how the rise in pro.pdf
arihantpatna
 
17) Fill out the following table Structure Pili or Fimbriae Flagella.pdf
17) Fill out the following table Structure Pili or Fimbriae Flagella.pdf17) Fill out the following table Structure Pili or Fimbriae Flagella.pdf
17) Fill out the following table Structure Pili or Fimbriae Flagella.pdf
arihantpatna
 

More from arihantpatna (20)

Compare and contrast the advantages and disadvantages of arrays and .pdf
Compare and contrast the advantages and disadvantages of arrays and .pdfCompare and contrast the advantages and disadvantages of arrays and .pdf
Compare and contrast the advantages and disadvantages of arrays and .pdf
 
Answer and describe the following five plants habit, habitat, life .pdf
Answer and describe the following five plants habit, habitat, life .pdfAnswer and describe the following five plants habit, habitat, life .pdf
Answer and describe the following five plants habit, habitat, life .pdf
 
A plant has the genotype (Aa; Bb; Cc). How many different genotype.pdf
A plant has the genotype (Aa; Bb; Cc). How many different genotype.pdfA plant has the genotype (Aa; Bb; Cc). How many different genotype.pdf
A plant has the genotype (Aa; Bb; Cc). How many different genotype.pdf
 
A) Explain how bilateral symmetry contributed to motion and cephaliz.pdf
A) Explain how bilateral symmetry contributed to motion and cephaliz.pdfA) Explain how bilateral symmetry contributed to motion and cephaliz.pdf
A) Explain how bilateral symmetry contributed to motion and cephaliz.pdf
 
_______ are any substances that when introduced into the body, stimul.pdf
_______ are any substances that when introduced into the body, stimul.pdf_______ are any substances that when introduced into the body, stimul.pdf
_______ are any substances that when introduced into the body, stimul.pdf
 
You decide to spend Break hiking through the Rockies upon arrival, yo.pdf
You decide to spend Break hiking through the Rockies upon arrival, yo.pdfYou decide to spend Break hiking through the Rockies upon arrival, yo.pdf
You decide to spend Break hiking through the Rockies upon arrival, yo.pdf
 
Write a program in Java that reads a set of doubles from a file, sto.pdf
Write a program in Java that reads a set of doubles from a file, sto.pdfWrite a program in Java that reads a set of doubles from a file, sto.pdf
Write a program in Java that reads a set of doubles from a file, sto.pdf
 
Which of the following statements is true about cultureA. Culture.pdf
Which of the following statements is true about cultureA. Culture.pdfWhich of the following statements is true about cultureA. Culture.pdf
Which of the following statements is true about cultureA. Culture.pdf
 
Which data set has the least sample standard deviation Data set (ii.pdf
Which data set has the least sample standard deviation  Data set (ii.pdfWhich data set has the least sample standard deviation  Data set (ii.pdf
Which data set has the least sample standard deviation Data set (ii.pdf
 
Whats wrong with this Hardy Weinberg question I thought it was a.pdf
Whats wrong with this Hardy Weinberg question I thought it was a.pdfWhats wrong with this Hardy Weinberg question I thought it was a.pdf
Whats wrong with this Hardy Weinberg question I thought it was a.pdf
 
6. List and define the underlying conditions, or assumptions, which .pdf
6. List and define the underlying conditions, or assumptions, which .pdf6. List and define the underlying conditions, or assumptions, which .pdf
6. List and define the underlying conditions, or assumptions, which .pdf
 
What does the LP tableau below indicate (The xs are decision varia.pdf
What does the LP tableau below indicate (The xs are decision varia.pdfWhat does the LP tableau below indicate (The xs are decision varia.pdf
What does the LP tableau below indicate (The xs are decision varia.pdf
 
Wha is the difference between the large intestine and colon .pdf
Wha is the difference between the large intestine and colon .pdfWha is the difference between the large intestine and colon .pdf
Wha is the difference between the large intestine and colon .pdf
 
Was airpower decisive in winning World War II Defend your answer..pdf
Was airpower decisive in winning World War II Defend your answer..pdfWas airpower decisive in winning World War II Defend your answer..pdf
Was airpower decisive in winning World War II Defend your answer..pdf
 
Summarize the workflow of the study of microbial diversity. Draw a d.pdf
Summarize the workflow of the study of microbial diversity. Draw a d.pdfSummarize the workflow of the study of microbial diversity. Draw a d.pdf
Summarize the workflow of the study of microbial diversity. Draw a d.pdf
 
Shifting allocations most often arise as a result of which of the fo.pdf
Shifting allocations most often arise as a result of which of the fo.pdfShifting allocations most often arise as a result of which of the fo.pdf
Shifting allocations most often arise as a result of which of the fo.pdf
 
16.) How would you determine if Cellulous is hydrophobic or hydrophi.pdf
16.) How would you determine if Cellulous is hydrophobic or hydrophi.pdf16.) How would you determine if Cellulous is hydrophobic or hydrophi.pdf
16.) How would you determine if Cellulous is hydrophobic or hydrophi.pdf
 
Please Explain CompletelyWhat defines the beginning of the hepatic.pdf
Please Explain CompletelyWhat defines the beginning of the hepatic.pdfPlease Explain CompletelyWhat defines the beginning of the hepatic.pdf
Please Explain CompletelyWhat defines the beginning of the hepatic.pdf
 
Plant Diversity II –     Seed Plants1. Explain how the rise in pro.pdf
Plant Diversity II –     Seed Plants1. Explain how the rise in pro.pdfPlant Diversity II –     Seed Plants1. Explain how the rise in pro.pdf
Plant Diversity II –     Seed Plants1. Explain how the rise in pro.pdf
 
17) Fill out the following table Structure Pili or Fimbriae Flagella.pdf
17) Fill out the following table Structure Pili or Fimbriae Flagella.pdf17) Fill out the following table Structure Pili or Fimbriae Flagella.pdf
17) Fill out the following table Structure Pili or Fimbriae Flagella.pdf
 

Recently uploaded

How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 

Recently uploaded (20)

How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 

#include iostream #include fstream #include shirtType.h.pdf

  • 1. #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:
  • 2. 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="";
  • 3. 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 //shirtType.h #include #include using namespace std;
  • 4. 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(); int changeQuan(); int getShirtId(int); shirtType(); int search(int); shirtType(int,string,string,double,int); }; int shirtType::search(int sellId) { if(shirtID == sellId) return 1; else return 0; } int shirtType::getShirtId(int i) { return shirtID; } shirtType::shirtType(int i,string c,string s, double p, int q) { color = c; size = s; if(i>0) shirtID=i;
  • 5. 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)
  • 6. quantity=q; else quantity = 0; } void shirtType::newQuan() { int q; cout<<"Enter the new quantity of shirts: "<>q; quantity += q; } int shirtType::changeQuan() { if(quantity > 0 ) { quantity -= 1; return 1; } { return 2; } } void shirtType::print() const { cout<<"Shirt ID: "< #include #include #include "shirtType.h" #include using namespace std; void getInput(shirtType s[],ifstream& infile, int& numShirts); void addShirt(shirtType s[], int& numShirts); void sellShirt(shirtType s[], int& numShirts); void addstockShirt(shirtType s[], int& numShirts); int main() { int numShirts;
  • 7. char ch; shirtType shirts[500]; ifstream infile; infile.open("shirtlab.txt"); getInput(shirts,infile,numShirts); // cout<>ch; do{ switch(ch) { case 'a': addShirt(shirts,numShirts); break; case 's': sellShirt(shirts,numShirts); break; case 'r': addstockShirt(shirts,numShirts); break; case 'p': for(int i =0; i>ch; }while(ch!='q'); infile.close(); return 0; } void getInput(shirtType s[], ifstream& infile, int& numShirts) { int id, q,index=0; string c,size; double p; infile>>id; infile.ignore(100,' '); getline(infile,c); infile>>size>>p>>q; while(infile) {
  • 8. s[index].setAll(id, c, size, p, q); index++; infile>>id; infile.ignore(100,' '); getline(infile,c); infile>>size>>p>>q; } numShirts=index; } void addShirt(shirtType s[], int& numShirts) { int id, q,index=numShirts; // cout<>id; cout<<" Shirt Color:"; cin>>c; // getline(cin,c); cout<<" Shirt size price and quantity:"; cin>>size>>p>>q; s[index].setAll(id, c, size, p, q); index++; numShirts=index; // cout<>sellId; for(i =0; i>stockId; for(i =0; i