Question: How do I get the program to access my numbers document? also I have this code but I dont know how to copy to dev

How do I get the program to access my numbers document? also I have this code but I dont know how to copy to dev c ++ to get it to work, I tried creating 3 different source files labeling them accordingly but got an error saying "stdax." no such file in directory. So I cant run it, and I tried using another code on here but it wouldnt access the number document (keep in mind i dont know anything about files i/o)#include "stdafx.h"
#include "List.h"
#include **=
------------
// LinkedList.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "List.h"
#include
#include
#include
using namespace std;
int main()
{
List * list = new List();
string line;
ifstream myfile("numbers.txt");
if (myfile.is_open())
{
while (getline(myfile, line))
{
list->Insert(stod(line));
}
myfile.close();
}
else cout "Unable to open file";
list->Display();
list->DeletNegative();
list->Display();
int index;
cout "Enter index to insert : ";
cin >> index;
double num;
cout "Enter number to insert : ";
cin >> num;
list->Insert(index, num);
list->Display();
cout "Enter index to delete : ";
cin >> index;
list->Delete(index);
list->Display();
return 0;
}
List.cpp: -------------------------------
#include
#include "List.h"
#include
using namespace std;
List::List()
{
}
List::~List()
{
}
void List::Insert(int index, double value)
{
int count =1;
Node * node = root;
Node * parent = root;
if (node == NULL && index >1)
{
return;
};
if (node == NULL && index ==1)
{
Node * newnode = new Node();
newnode->data = value;
newnode->next = NULL;
node->next = newnode;
return;
}
if (node != NULL && index ==1)
{
Node * newnode = new Node();
newnode->data = value;
newnode->next = node;
root = newnode;
return;
}
while (node->next != NULL )
{
parent = node;
node = node->next;
count++;
if (count == index)
break;
}
if (count != index)
{
cout "invalid index" endl;
return;
}
if (node != NULL)
{
Node * newnode = new Node();
newnode->data = value;
newnode->next = NULL;
newnode->next = node;
parent->next = newnode;
return;
}
}
void List::Insert(double value)
{
Node * node = root;
if (node == NULL)
{
root = new Node();
root->data = value;
root->next = NULL;
return;
};
while (node->next != NULL)
{
node = node->next;
}
Node * newnode = new Node();
newnode->data = value;
newnode->next = NULL;
node->next = newnode;
return;
}
void List::Delete(int index)
{
int count =1;
Node * node = root;
Node * parent = root;
if (node == NULL && index >1)
{
cout "invalid index" endl;
return;
};
if (node != NULL && index ==1)
{
root = node->next;
return;
}
while (node->next != NULL)
{
parent = node;
node = node->next;
count++;
if (count == index)
break;
}
if (count != index)
{
cout "invalid index" endl;
return;
}
if (node != NULL)
{
parent->next = node->next;
return;
}
}
void List::Display()
{
Node * node = root;
if (node == NULL) return;
while (node->next != NULL )
{
cout node->data endl;
node = node->next;
}
cout node->data endl;
return;
}
void List::DeletNegative()
{
Node * node = root;
Node * parent = root;
if (node == NULL) return;
while (node->next != NULL)
{
if (node->data 0)
{
parent->next = node->next;
}
parent = node;
node = node->next;
}
return;
}
List.h: -----------------------------------------
#pragma once
struct Node {
double data;
struct Node *next;
};
class List
{
public:
List();
~List();
void Insert(int index, double value);
void Insert(double value);
void Delete(int index);
void Display();
void DeletNegative();
private:
Node * root;
};
 How do I get the program to access my numbers document?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!