In: Computer Science
Create a C++ program to simulate an art gallery:
Title of painting
Artists first name
Artists last name
Address street number
Address street name
Address city
Address state
Address zip
Artists website
Category
Number
Should print to a file all of the paintings by category and in alphabetical order based on the artist's last name.
This is an example txt file but the program will be tested with multiple files with different numbers of paintings:
Full Fathom Five
Jackson
Pollock
16
Woodbury
Springs
NY
11937
www.jacksonpollock.com
Abstract
978-3-16-148410-0
Impression, Sunrise
Claude
Monet
361
Sunflower
Giverny
France
27620
www.claudemonet.com
Impressionism
968-3-16-158420-0
A Sunday Afternoon on the Island of La Grande Jatte
Georges
Seurat
89
Longview
Paris
France
75006
www.gseurat.com
Pointillism
918-3-15-152420-0
uses of c++ C++ is used by programmers to create computer software.. C++ is mostly used to write device driver programs, system software, and applications that depend on direct hardware manipulation under real-time constraints. input include <iostream> using namespace std; #define MAX_LENGTH 100
void printInitials(const string& name)
{
if (name.length() == 0)
return;
// Since touuper() returns int, we do typecasting
cout << (char)toupper(name[0]);
// Traverse rest of the string and print the
// characters after spaces.
for (int i = 1; i < name.length() - 1; i++)
if (name[i] == ' ')
cout << " " << (char)toupper(name[i + 1]);
}
// Driver code
int main()
{
string name = "Impression, Sunrise";
printInitials(name);
} int main() { char name[MAX_LENGTH]={0}; cout<<"Enter first name of the person: "; cin.getline(name,MAX_LENGTH); cout<<"Enter last name of the person: ";
cin.getline(name,max_LENGTH);
};
class address { int hno; char cty[30]; char state[30]; public : void getad() { cout<<"house number : "; cin>>hno; cout<<"city :"; cin>>cty; cout<<"state : "; cin>>state; } void putad() { cout<<"House No.: "<<hno<<",city: "<<cty<<",state: "<<state<<endl; } };
int main()
{
char website[MAX_LENGTH]={0};
cout<<"Enter website : ";
cin.getline(website,MAX_LENGTH);
cout<<"Enter category: ";
cin.getline(category,max_LENGTH);
clrscr();
int i, num;
cout<<"Enter a number: ";
cin>>num;
cout<<"\nTable of "<<num<<" is:\n\n";
for(i=1; i<=10; i++)
{
cout<<num<<setw(3)<<"*"<<setw(4)<<i<<setw(4)<<"="<<setw(4)<<num*i<<"\n";
}
getch();
output
Title of painting:Impression, Sunrise
Enter first name : Claude
Enter last name : Monet
Address street number : 361
Address street name : Giverny
Address city : France
Enter website : www.claudemonet.com
Category : Impressionism
Number : 968-3-16-158420-0