Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <string.h>
- #include<sstream>
- #include <ctype.h>
- #include<cctype>
- #include<list>
- using namespace std;
- ////////////////////////////////////////////////////////////////////////////////////////
- // Constances
- ////////////////////////////////////////////////////////////////////////////////////////
- #define N_PRODUCT 2
- struct Brand_t {
- int Model_Num;
- string Product_Name;
- list<string> Colors;
- } brands[2];
- ////////////////////////////////////////////////////////////////////////////////////////
- // Functions
- ////////////////////////////////////////////////////////////////////////////////////////
- using namespace std;
- int main()
- {
- string mystr;
- int n;
- for (n = 0; n < N_PRODUCT; n++)
- {
- cout << "Enter Model Number: ";
- brands[n].Model_Num = 1 + n;
- cout << "Enter Product Name: ";
- brands[n].Product_Name = "qw";
- list<string>::iterator it;
- brands->Colors.push_back("Red");
- brands->Colors.push_back("Yellow");
- brands->Colors.push_back("Blue");
- }
- for (n = 0; n < N_PRODUCT; n++)
- {
- std::list<string>::iterator findIter = std::find(brands->Colors.begin(), brands->Colors.end(), "Blue");
- if (brands->Colors.end() == findIter)
- {
- std::cout << "item not found" << std::endl;
- }
- else
- {
- const int pos = std::distance(brands->Colors.begin(), findIter) + 1;
- std::cout << "item divisible by 17 found at position " << pos << std::endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment