Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <algorithm>
- #include <string>
- #include <fstream>
- #include <sstream>
- #include <set>
- #include <map>
- #include "list.h"
- using namespace std;
- ifstream in("input.txt");
- ofstream out("output.txt");
- class Forum {
- public:
- string nick, town;
- int age;
- Forum() {}
- Forum(string nick, string town, int age) {
- setNick(nick);
- setTown(town);
- setAge(age);
- }
- void setNick(string nick) {
- this->nick = nick;
- }
- void setTown(string town) {
- this->town = town;
- }
- void setAge(int age) {
- this->age = age;
- }
- void printout() {
- cout << nick << " " << town << " " << age << endl;
- }
- };
- int main() {
- vector <Forum> vec(4);
- list <Forum> lst;
- vec[0] = Forum("myloyo", "saratov", 18);
- vec[1] = Forum("skrpopova", "saratov", 15);
- vec[2] = Forum("karych", "saratov", 15);
- vec[3] = Forum("soap", "moscow", 100);
- //буква а
- Forum h;
- cin >> h.nick >> h.town >> h.age;
- bool p = 1;
- for (auto x : vec) {
- if (x.nick == h.nick) {
- p = 0;
- }
- }
- if (p) {
- vec.push_back(h);
- }
- for (auto x : vec) {
- x.printout();
- }
- int n;
- cin >> n;
- string nn, tt;
- cin >> nn >> tt;
- vec[n].setNick(nn);
- vec[n].setTown(tt);
- for (auto x : vec) {
- x.printout();
- }
- cout << endl << endl;
- // буква б
- for (auto x : vec) {
- lst.insert(lst.getlength(), x);
- }
- for (int i = 0; i < lst.getlength(); i++) {
- lst[i].printout();
- }
- cout << endl;
- Forum z;
- cin >> z.nick >> z.town >> z.age;
- lst.insert(0, z);
- cout << endl;
- for (int i = 0; i < lst.getlength(); i++) {
- lst[i].printout();
- }
- string k;
- cin >> k;
- int r = 0;
- for (int i = 0; i < lst.getlength(); i++) {
- if (lst[i].nick.length() == k.length()) {
- for (int j = 0; j < k.length(); j++) {
- if (k[j] != lst[i].nick[j]) {
- r++;
- }
- }
- if (r <= 1) {
- lst.insert(lst.getlength(), lst[i]);
- lst.remove(i);
- }
- }
- }
- for (int i = 0; i < lst.getlength(); i++) {
- lst[i].printout();
- }
- }
- soup saratov 17
- 2
- kkkkr spb
- idk msk 900
- soap
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement