Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int number;
- struct subsequence { float data; float power; subsequence* next; subsequence* pred; } *S;
- void Read_subsequence(subsequence* S) // функция формирования списка
- {
- subsequence* t;
- t = S;
- ifstream F;
- F.open("file1.txt");
- if (!F.is_open())
- {
- cout << "Ошибка откытия файла" << endl;
- }
- else {
- cout << "Файл открыт" << endl;
- while (!F.eof())
- {
- F >> number; // заглавное звено
- t->next = new subsequence;
- t = t->next;
- t->data = number;
- }
- t->next = new subsequence;
- t = t->next;
- t->data = number;
- t->next = NULL;
- }
- F.close();
- }
- void Print(subsequence* S)
- {
- ofstream fout("file3.txt", ios_base::app);
- subsequence* t;
- fout << "Да это же полином!" << endl;
- for (t = S->next; t->next != NULL; t = t->next)
- {
- fout << "| " << t->data << endl;
- }
- fout << endl;
- }
- int main()
- {
- setlocale(LC_ALL, "RUS");
- S = new subsequence;
- Read_subsequence(S);
- Print(S);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement