Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // task_2.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
- //
- /*
- ПРАВИЛЬНОСТЬ ВВЕДЁННЫХ СЛОВ ИСПОЛЬЗУЯ СЛОВАРЬ. УПОРЯДОЧЕННЫЙ ЛИНЕЙНЫЙ СПИСОК ПО ЗАГОТОВЛЕННОМУ ФАЙЛУ. еСЛИ НА 40% И БОЛЬШЕ СОВПАДАЕТ, ТО КОМП КОРРЕКТИРУЕТ
- ИНАЧЕ ГОВОРИТ ШО ВСЁ НЕ ТО.
- */
- #include "pch.h"
- #include <iostream>
- #include <string>
- #include <fstream>
- using namespace std;
- struct List
- {
- string data;
- List *next;
- };
- void Print(List *list)
- {
- List *p = list;
- cout << "List:" << endl;
- while (p)
- {
- cout << p->data << endl;
- p = p->next;
- }
- }
- int main()
- {
- setlocale(0, "");
- ifstream file("C:\\Users\\Владимир\\source\\repos\\task_2\\dictionary.txt");
- ///*
- List *first = new List;
- List *next = new List;
- first->next = nullptr;
- while (!file.eof())
- {
- if (first->next == nullptr)
- {
- file >> first->data;
- first->next = next;
- }
- else
- {
- next->next = new List;
- file >> next->data;
- next = next->next;
- }
- }
- if (file.eof())
- next->next = nullptr;
- Print(first);
- //*/
- cout << "Hello World!\n";
- return 0;
- }
Add Comment
Please, Sign In to add comment