Please help, I don't know why it is not reading the file. I am working in VS C++ 2008, I saved "input_data.txt" in the header files, see below. What is wrong?
#include <iostream>
#include <fstream>
#include <ctime>
#include <cstdlib>
#include "input_data.txt.h"
using namespace std;
class Node {
public:
int x;
Node *next;
Node *prev;
};
class periodicElement
{ Node *head, *current, *prev, *tail;
public:
periodicElement(){
head = current = prev = tail = NULL;
}
//***** builds linked list ******//
void add(int value) {
current = new Node;
current -> x = value;
current -> next = NULL;
current -> prev = NULL;
//***** check if head equal to NULL *****//
if (head==NULL){
head = current;
tail = current;}
else {
prev -> next = current;
current -> prev = prev;
}
tail = prev = current;
}
//****** prints the linked list *****//
void printRight() {
current = head;
while (current!=NULL) {
cout << current -> x << endl;
current = current -> next;
}
}
void printLeft() {
current = tail;
while (current != NULL) {
cout << current -> x << endl;
current = current -> prev;
}
}
};
//* an entry point for execution *//
int main() {
ofstream outputFile("input_data.txt");
ifstream inputFile;
periodicElement one;
one.add(23);
one.insertNode(35);
one.add(90);
cout << "This prints from right to left:" << endl;
one.printRight();
cout << endl;
cout << "This prints from left to right:" << endl;
one.printLeft();
}