#include<iostream>

#include<fstream>

using namespace std;

int main()

{

	dnode<double> *listA = new dnode<double>;

	dnode<double> *listB = new dnode<double>;

	int val1; //first set of integers

	int val2; //second set of integers

	ifstream inFile; //declares the inFile

	//Read in a file to build the two lists

	inFile.open("lnkList.in"); //Open the input file

	//statement for file not found
    if (!inFile){
		
		cout << "Unable to open file"; //output statement for file not found

		exit(1); //terminate with error
    }
	
	inFile >> val1 >> val2;//reads in the file with a pair of integers


//Pointers to build the orginal two lists
	
	dnode <double> *p = listA -> next; //points to the node following the header of listA

//Nested for loop to read in up to val1 # of doubles

	for (int i = 0; i < val1; i++)
	{

     for (int j = 0; j < i; j++)
     {
		 if(val1 < val)//the value at the pointer is less then the new value
		 {
			 *p -> next;//move the pointer forward.
		 }

		 else{
			 include (p, val);//else insert the new value now
		 }
	 }
	 
	 dnode <double> *p2 = listB -> next; //points to the node following the header of listB

//Nested for loop to read in up to val2 # of doubles

	for (int i = 0; i < val2; i++)
	{

     for (int j = 0; j < i; j++)
     {
		 if(val2 < val)//the value at the pointer is less then the new value
		 {
			 *p2 -> next;//move the pointer forward.
		 }

		 else{
			 include (p2, val);//else insert the new value now
		 }
	 }

    return 0;
}

this is what i have so far but I do not think that what i have is compiling correctly, i am trying to declare lists and i thought that is what i did. i have so many compiling errors, and i tried fixing them. but not working for me, any help?

what is dnode? Where is it declared ?

Where are the declarations of dnode and the include function? Other than that, quickly looking through the code: if(val1 < val) would not work, since there is no declaration for it. I am assuming you meant something like if(val1 < p->val) Also the statement *p->next; would not do anything. It would simply give the structure pointed to by the structure *p, but would not assign it to anything. p = p->next; would do that.

#include<iostream>

#include<fstream>

using namespace std;

int main()

{

    dnode<double> *listA = new dnode<double>;

    dnode<double> *listB = new dnode<double>;

    int val1; //first set of integers

    int val2; //second set of integers

    ifstream inFile; //declares the inFile

    //Read in a file to build the two lists

    inFile.open("lnkList.in"); //Open the input file

    //statement for file not found
    if (!inFile){

        cout << "Unable to open file"; //output statement for file not found

        exit(1); //terminate with error
    }

    inFile >> val1 >> val2;//reads in the file with a pair of integers


//Pointers to build the orginal two lists

    dnode <double> *p = listA -> next; //points to the node following the header of listA

//Nested for loop to read in up to val1 # of doubles

    for (int i = 0; i < val1; i++)
    {

     for (int j = 0; j < i; j++)
     {
         if(val1 < p ->val)//the value at the pointer is less then the new value
         {
             p = p ->next;//move the pointer forward.
         }

         else{
             include(p, val);//else insert the new value now
         }
     }

     dnode <double> *p2 = listB -> next; //points to the node following the header of listB

//Nested for loop to read in up to val2 # of doubles

    for (int i = 0; i < val2; i++)
    {

     for (int j = 0; j < i; j++)
     {
         if(val2 < p->val)//the value at the second pointer is less then the new value
         {
             p2 = p2 ->next;//move the pointer forward.
         }

         else{
             include(p2, val);//else insert the new value now
         }
     }

    return 0;
}

in order to declare the dnode and include functions:

it would be near the top? but wouldnt it be like dnode<double> = listA, listB;

The code you originally posted does not include that header file. You need to add it after <fstream> then recompile to see how many errors disappear.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.