#include header files won't allow me to complie

Pages: 12
Write your question here.
I'm having trouble compiling my program whenever I include my header files for my view and my controller. I do have several classes so bare with me. When I call my function from main instead of view-controller, everything is fine. I think it has something to do w/ my header files.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 #pragma once
#include "PA4.h"
#include "Customer.h"
class Controller

{
public:
	Controller(void);
	~Controller(void);
	void addCustomer(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]);
	void showCustomerInfo(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]);
	void rentVideo(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]);
	void showVideoInfo(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]);
	void Exit();

private:
	VideoStore video;
	Customer custobject;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25


#include "stdafx.h"
#include<iostream>
#include <string>
#include <fstream>
#include <cstddef> 
//#include "Rent.h"
#include"Customer.h"
#include "View.h"
#include "Controller.h"
using namespace std;
class VideoStore
	{
	public: 
		
		void addVideoStoreInfo(int &checkint, int& b, int &n,string ID[],string title[], string movie[],string ID2[],string Names[]);
		void display(int &checkint, int& b, int &n,string Names[]);
		int counter(int &count,int &b, int &n);
		int countID(int &b);
		
		//string toString(int &total);
		 VideoStore();
		 string getname();
		 string customer;


1
2
3
4
5
6
7
8
9
10

#pragma once
#include "Controller.h"
class View
{
public:
	View(void);
	~View(void);
	void showSelection(int tot,int tot2,int tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]);


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

#pragma once
#include<iostream>
#include <string>
#include <string>
#include <fstream>
#include <cstddef> 
using namespace std;
#include "Rent.h"
#include "PA4.h"
class Customer : VideoStore
{
public:
	Customer(void);
	~Customer(void);
	void enterCustInfo(int&n, int&p,int &customer,int &h,string ID[],string title[],string movie[],string ID2[],string Names[]);
	void display(int&n, int&p,int &customer,int &h,string ID[],string title[],string movie[],string ID2[],string Names[]);
private: 



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

#pragma once
#include<iostream>
#include <string>
#include <string>
#include <fstream>
#include <cstddef> 
//#include "Customer.h"
using namespace std;
class Rent
{
public:
	Rent(void);
	~Rent(void);
	void rentVideos(int &videos,int &count2,int &r,int&y,string ID[],string title[], string movie[],string ID2[]);
	int videocounter(int &videos);


Maybe I'm including .h files in a loop(A.h includes B.h, B.h includes A.h)
What is your compiler error?

I'm not sure what #pragma once is, I've always used #ifndef for header guards.
Maybe I'm including .h files in a loop(A.h includes B.h, B.h includes A.h)

Yes, that is your problem. Only include the headers that you need.
megatron 0, #pragma once is for different compliers I believe, but it works.


Peter 87, I did include #pragma once in VideoStore and I have a lot less errors, however, these are the erroes I am getting:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\customer.h(11): error C2504: 'VideoStore' : base class undefined
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\controller.h(17): error C2146: syntax error : missing ';' before identifier 'video'
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\controller.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\controller.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>  Customer.cpp
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\controller.h(17): error C2146: syntax error : missing ';' before identifier 'video'
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\controller.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\controller.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\controller.h(18): error C2146: syntax error : missing ';' before identifier 'custobject'
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\controller.h(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\controller.h(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\customer.cpp(38): warning C4258: 'n' : definition from the for loop is ignored; the definition from the enclosing scope is used
1>          c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\customer.cpp(25) : definition of 'n' ignored
1>          c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\customer.cpp(14) : definition of 'n' used
1>  Controller.cpp
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\customer.h(11): error C2504: 'VideoStore' : base class undefined
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\view.h(11): error C2146: syntax error : missing ';' before identifier 'control'
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\view.h(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\houst_000\documents\visual studio 2010\projects\pa4\pa4\view.h(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
You have forgot to include the VideoStore header from customer.h.
The PA4.h is the header for the VideoStore class. Do you mean I forgot to include the PA4.h in customer.h?
Ok, but why PA4.h includes customer.h?
It's hard to tell from your post what your header files names are. i.e. it's not clear that the VideoStore class declaration is in the PA4.h header.

As Peter87 said, the first error indicates that the compiler has not seen the videostore.h (pa4.h ?) header.

BTW, customer.h line 11 you're missing the public / protected / private visibility specifier for the base class.

I also don't see your main.ccp, so can't tell the order in which your headers are included from there. It's the .cpp file that determines the order in which the headers are included.

You do have circular include dependencies.
videostore.h includes customer.h
customer.h includes pa4.h (videostore.h ?)

You also seem to have unnecessary includes that may be contributing to your problem. e.g. VideoStore.h (pa4.h ?) includes customer.h, controller.h, view.h but does not seem to use them. Likewise, view.h include controller.h, but does not appear to use it.

It's also not clear if there is more to your class declarations, or you just did not copy/past the final };

Also, it's poor practice to put using namespace std; in header files.
Last edited on
1
2
3
4
5
6
7
8
9
#pragma once
#include<iostream>
#include <string>
#include <string>
#include <fstream>
#include <cstddef> 
//#include "Customer.h"
using namespace std;
class Rent

1
2
3
4
5
6
7
8
9
10
11
12
13
#pragma once
#include "stdafx.h"
#include<iostream>
#include <string>
#include <fstream>
//#include <cstddef> 
//#include "Rent.h"
using namespace std;
#include "View.h"
//#include"Customer.h"


class VideoStore

1
2
3
4
// PA4.cpp : Defines the entry point for the console application.
//
#include "StdAfx.h"
#include "PA4.h" 
This is my main inside of PA4.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
int _tmain(int argc, _TCHAR* argv[])
{
	VideoStore emp;
	//Customer customer;
	//Rent rent;
	int tot=0;
	int tot2=0;
	int tot3=0;
	int var;
	
	int tot5=0;
		
		string title2[20];
		string movie2[20];
		string ID2[20];
		string ID3[20];
		string name2[20];
	emp.addVideoStoreInfo(tot,tot2,tot3,ID2,title2,movie2,ID3,name2);
	View view;
	emp.display(tot,tot2,tot3,name2);
	view.showSelection(tot,tot2,tot3,ID2,title2,movie2,ID3,name2);
	int tot4= emp.counter(var,tot2,tot3);
	int tot6=tot;
	int tot7=0;

1
2
3
4
5
#include "StdAfx.h"
#include "Controller.h"


Controller::Controller(void)
1
2
3
4
5
#include "StdAfx.h"
#include "View.h"
#include <iostream>
using namespace std;
View::View(void)
1
2
3
4
5
6
7
8
9
10
11
#pragma once
#include<iostream>
#include <string>
#include <string>
#include <fstream>
#include <cstddef> 
using namespace std;
#include "PA4.h"
#include "Rent.h"

class Customer : public VideoStore


1
2
3
4
5
#pragma once
using namespace std;
#include "Controller.h"

class View
1
2
3
4
5
#include "StdAfx.h"
#include "Rent.h"


Rent::Rent(void)
1
2
3
4
5
#include "StdAfx.h"
#include "Customer.h"


Customer::Customer(void)
1
2
3
4
5
6
7
8
9
#pragma once
#include<iostream>
#include <string>
#include <string>
#include <fstream>
#include <cstddef> 
//#include "Customer.h"
using namespace std;
class Rent
thank you for your help this far, I changed some of the includes to this: but I am still getting errors. There are all of my .h and .cpp files.
Are you intentionally trying to be obtuse about what you are posting?
This last post is even harder to follow than your earlier post.
I'd really like to help, but you're not making it easy.

You say you're still getting errors. Are we supposed to be mind readers about what those errors are since you haven't posted code that is compilable.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include "stdafx.h"
#include<iostream>
#include <string>
#include <fstream>
//#include <cstddef> 
//#include "Rent.h"
using namespace std;
#include "View.h"
//#include"Customer.h"


class VideoStore
	{
	public: 
		
		void addVideoStoreInfo(int &checkint, int& b, int &n,string ID[],string title[], string movie[],string ID2[],string Names[]);
		void display(int &checkint, int& b, int &n,string Names[]);
		int counter(int &count,int &b, int &n);
		int countID(int &b);
		
		//string toString(int &total);
		 VideoStore();
		 string getname();
		 string customer;
	
private:
	
        
		 string position;
		 int number2; 
		 string name_;
		 string Names[20];
		 string dept2; 
		 string answer;
		 string sweeping2;
		 int patientnum;
		  string ID2[20]; 
		  string newname;
		// string position_;
		  string title[20];
		 string moviestar1[20];
      string moviestar2[20];
     string dept[20];
      string producer [20];
       string director [20];
	   string movie[20];
        int num_videos[20];
       string company [20];
       string ID[20]; 
         
		string firstname[20];
		string secname[20];
		//int checkint;
		 int num_copies[20];
		 int admin;
		 int total;
		
      

	};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// PA4.cpp : Defines the entry point for the console application.
//
#include "StdAfx.h"
#include "PA4.h"

	
	 VideoStore::VideoStore(){}
	void VideoStore::addVideoStoreInfo(int& checkint,int &b, int &a,string ID[],string title[], string movie[],string ID2[],string Names[])
{
	

		  ifstream input;
	
	 total=0;
	
	 input.open("C:\\Users\\houst_000\\Desktop\\Programming Assignment 4 Data.txt",ios::in);
	 if (input.fail()){
		 cout<<"sorry, could not read file";
	 system("pause");
	 exit(1);
	 }
	  string Position;
	
	string Name;
		   
		  
		 int index=0;  
		input>> checkint;	  
		   string stri;
		  
	while(!input.eof()){
		     getline(input,stri , '\n');  
	for (int n=0; n<checkint; n++){
		
     
         getline(input, Name, '\n');


          title[n]=Name;
		   //while(getline(input, Name,'\n')&&(getline(input, Name,'\n'))){

		  getline(input, Name, '\n');
		//  if (Name=="\n")
		  moviestar1[n]=Name;

		  getline(input, Name, '\n');
		  //if (Name=="\n")
		 moviestar2[n]=Name;
		 
		 getline(input, Name, '\n');
		  //if (Name=="\n")
		 producer[n]=Name;

		 getline(input, Name, '\n');
		  //if (Name=="\n")
		 director[n]=Name;
		  //input>>producer[n]>>director[n];
		   getline(input, Name, '\n');
		  company[n]=Name;

		  input>>num_copies[n];
		    
		 total++;
             cout<<title[n]<<","<<moviestar1[n]<<" ,"<<moviestar2[n]<<" "
		  <<producer[n]<<", "<<director[n]<<", "<<company[n]<<", "<<num_copies[n]<<endl;
            getline(input, Name, '\n'); }
	int number=0;
	
	string newcustomer;
	string hey="ggg";
	while(a<40 ){
//getline(input, customer,'\n');
		//number =input.peek();
		
		
getline(input, newcustomer,',');

string string;
	string= newcustomer.substr(1,1); 
	cout<<newcustomer.substr(1,1);
cout<<string<<endl;

for (int d=0; d<a;d++){
	if (string== ID[d])
	{ID2[0]=string;
		goto lastsection;}
}
//if (input>>number){
	//	ID2[a]=number;
	//  system("pause");
	//	break;}
//else
			firstname[a]=newcustomer;
getline(input, newcustomer,',');		

		secname[a]=newcustomer;
		input>>ID[a];
	
	//if (number>=0||number<10000000){
	//	ID2[a]=number;
	//	break;}
			 //hey.at (hey.length () - 1);
			// ID[a]=hey;
	//	cin.ignore(firstname[a].size()-1,'\n'); 
		//	getline(input,newcustomer); 
		//	ID[a]=newcustomer;
			//getline(input, customer,',');
			//secname[a]=customer;
			//input>>ID[a];
			
			cout<<	firstname[a]<<","<<secname[a]<<endl;
			Names[a]=firstname[a]+","+secname[a];
			cout<<ID[a]<<endl;
			a++;
				
			
	}
lastsection:{
int c=0;
//input>>ID2[c];
getline(input, customer, '\n');
				movie[c]=customer;
	cout<<ID2[c]<<" ,,"<<movie[c]<<endl;
				c++;			
	 b=1;
	while (!input.eof()){
				getline(input, customer, ',');
		ID2[b]=customer;
		//getline(input, customer, ',');
				getline(input, customer, '\n');
				movie[b]=customer;
				
		cout<<ID2[b]<<",,"<<movie[b]<<endl;
		b++;
		
	}
	system("pause");
	
	}
	}
	}
	 int VideoStore:: counter(int &count,int &b, int &n){
			return n;
	 }
	 int VideoStore:: countID(int &b){
			return b;
	 }
	 void VideoStore::display(int &checkint, int& b, int &n,string Names[]){
		cout<<title[1]<<endl;
		 for(int e=0; e<checkint;e++){
		// cout<<"Video Name: "<<Names[e]<<endl;
		 cout<<"Video Title: "<<title[e]<<endl;
		 cout<<"Video producer: "<<producer[e]<<endl; 
		 cout<<"Video director: "<<director[e]<<endl;
		 cout<<"Number of Copies: "<<num_copies[e]<<endl;

	 }
	 }
	 
int _tmain(int argc, _TCHAR* argv[])
{
	VideoStore emp;
	//Customer customer;
	//Rent rent;
	int tot=0;
	int tot2=0;
	int tot3=0;
	int var;
	
	int tot5=0;
		
		string title2[20];
		string movie2[20];
		string ID2[20];
		string ID3[20];
		string name2[20];
	emp.addVideoStoreInfo(tot,tot2,tot3,ID2,title2,movie2,ID3,name2);
	View view;
	emp.display(tot,tot2,tot3,name2);
	view.showSelection(tot,tot2,tot3,ID2,title2,movie2,ID3,name2);
	int tot4= emp.counter(var,tot2,tot3);
	int tot6=tot;
	int tot7=0;
	
	//customer.enterCustInfo(tot6,tot2,tot4,tot7,ID2,title2,movie2,ID3,name2);
	cout<<"---------------------------------VIDEO STORE-----------------------"<<endl;
	cout<<"1-Rent Video"<<endl;
	cout<<"2-Display Customer Info"<<endl;
	cout<<"3-Display List of available videos in store"<<endl;
	//customer.display(tot6,tot2,tot4,tot7,ID2,title2,movie2,ID3, name2);
	
	system("pause");
	return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#pragma once
using namespace std;
#include "Controller.h"

class View
{
public:
	View(void);
	~View(void);
	void showSelection(int tot,int tot2,int tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]);
private: 
	int userinput;
	Controller control;
};


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "StdAfx.h"
#include "View.h"
#include <iostream>
using namespace std;
View::View(void)
{
}


View::~View(void)
{
}
void View::showSelection(int tot,int tot2,int tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[])
{
    userinput=8;
	
	cout<<"---------------------------------VIDEO STORE-----------------------"<<endl;
	cout<<"1-Rent Video"<<endl;
	cout<<"2-Display Customer Info"<<endl;
	cout<<"3-Display List of available videos in store"<<endl;
	cout<<"4-Save List of available videos in store"<<endl;
	cout<<"0----------------EXIT----------------------"<<endl;
	cin>>userinput;
	if (userinput==1)
		control.rentVideo(tot,tot2,tot3,ID2,title2,movie2,ID3,name2);
	if(userinput==2)
		control.showCustomerInfo(tot,tot2,tot3,ID2,title2,movie2,ID3,name2);
	if (userinput==3) 
		control. showVideoInfo(tot,tot2,tot3,ID2,title2,movie2,ID3,name2);
	if(userinput==4)

	if(userinput==0)

		control.Exit();

}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
using namespace std;
#include "Customer.h"
#include "PA4.h"

class Controller

{
public:
	Controller(void);
	~Controller(void);
	void addCustomer(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]);
	void showCustomerInfo(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]);
	void rentVideo(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]);
	void showVideoInfo(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]);
	void Exit();

private:
	VideoStore video;
	Customer custobject;
	string ID3[20];
	string ID2[20];
	int tot7;
	string movie2[20];
	string title2[20];
	string name2[30];
};


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "StdAfx.h"
#include "Controller.h"


Controller::Controller(void)
{
}


Controller::~Controller(void)
{
}

	void Controller:: addCustomer(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]){
	
	}
	void Controller:: showCustomerInfo(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]){
		custobject.display(tot, tot2, tot3,tot7, ID2, title2, movie2, ID3, name2);
	}
	void Controller:: rentVideo(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]){
		custobject.enterCustInfo(tot, tot2, tot3,tot7, ID2, title2, movie2, ID3, name2);
	}
	void Controller:: showVideoInfo(int& tot,int& tot2,int& tot3,string ID2[],string title2[],string movie2[],string ID3[],string name2[]){
		video.display(tot, tot2, tot3, name2);
	}

	void Controller:: Exit(){

	}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include<iostream>
#include <string>
#include <string>
#include <fstream>
#include <cstddef> 
using namespace std;
#include "PA4.h"
#include "Rent.h"

class Customer : public VideoStore
{
public:
	Customer(void);
	~Customer(void);
	void enterCustInfo(int&n, int&p,int &customer,int &h,string ID[],string title[],string movie[],string ID2[],string Names[]);
	void display(int&n, int&p,int &customer,int &h,string ID[],string title[],string movie[],string ID2[],string Names[]);
private: 
	string custID;
	
	 int passed;
	 int checker;
		  string newname;
		string movie2[20];
		 string ID2[20];
		  string title[20];
		 string moviestar1[20];
      string moviestar2[20];
     string dept[20];
      string producer [20];
       string director [20];
	   string movie[20];
        int num_videos[20];
       string company [20];
       string ID[20]; 
      //  VideoStore video; 
		string firstname[20];
		string secname[20];
		int checkint;
		 int num_copies[20];
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "StdAfx.h"
#include "Customer.h"


Customer::Customer(void)
{
}


Customer::~Customer(void)
{
}

void Customer::enterCustInfo(int &n, int &p,int&customer,int &h,string ID[],string title[],string movie[],string ID2[],string Names[]){
	cout<<ID[1];
	cout<<"please enter your customer ID: "<<endl;
	cin>>custID;
	int tot;

	Rent renter;
	string a[20],b[20],c[20];
	cout<<customer<<endl;
	for (int m=0;m<customer;m++){
		if(custID==ID[m]){
			for(int n=0; n<p;n++){
				if (ID[m]==ID2[n]){
					cout<<"Returning Customer"<<endl;
					goto thishere;}
				
					}
			h=m;
			++p;
			ID2[p]=ID[m];
			
			thishere: {cout<<custID<<" is found in the system";
			
			cout<<p;
			renter.rentVideos(n,p,tot,h,ID,title,movie,ID2);}}}
		cout<<"sorry, that ID is not found, Please enter another ID: ";
			cin>>custID;
	
	

}

void Customer:: display(int&n, int&p,int &customer,int &h,string ID[],string title[],string movie[],string ID2[], string Names[]){
cout<<ID2[p];
for (int g=0; g<customer; g++){
	for(int h=0; h<=p; h++){
if (ID[g]==ID2[h]){
	cout<<" You rented Videos! "<<endl;
	
	//string temp=movie[g];
	movie2[g]=movie[h];
//movie[h]=temp;}
continue;
	}
}

for(int f=0; f<customer; f++){

cout<<"Customer Name: "<< Names[f]<< "    Customer ID: " <<ID[f] <<"   Movies rented: " <<movie2[f]<<endl;

}



}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include<iostream>
#include <string>
#include <string>
#include <fstream>
#include <cstddef> 
//#include "Customer.h"
using namespace std;
class Rent
{
public:
	Rent(void);
	~Rent(void);
	void rentVideos(int &videos,int &count2,int &r,int&y,string ID[],string title[], string movie[],string ID2[]);
	int videocounter(int &videos);
private:
	
	int checker;
	int passed;
	int num_of_videos;
	
	string titles;
	string title[20];
		 string moviestar1[20];
      string moviestar2[20];
     string dept[20];
      string producer [20];
       string director [20];
	   string movie[20];
        int num_videos[20];
       string company [20];
       string ID[20]; 
         
		string firstname[20];
		string secname[20];
		
		 int num_copies[20];
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "StdAfx.h"
#include "Rent.h"


Rent::Rent(void)
{
}


Rent::~Rent(void)
{
}

void Rent::rentVideos(int& videos, int &count2,int&r,int&y, string ID[],string title[], string movie[],string ID2[]){
	cout<<videos;
	cout<<"Please enter the title of the video you would like to rent: "<<endl;
	
	for ( int i=0; i< videos; i++){
		cout<<title[i]<<endl;}
	cin>>titles;
	//getline(cin,titles,'\n');

	for ( int i=0; i< videos; i++){
		if (titles==title[i]){
			cout<<"Found!";
			cout<<" "<<y<<"  "<<count2;
	for ( int j=0; j<count2; j++){
		if(ID[y]==ID2[j]){
	cout<<"found ID!";
	movie[j]= movie[j]+","+title[i];
		goto nextstep;}
		else

		cout<<movie[j]<<endl;
	}
			num_copies[i]--;
			
			movie[count2]=title[i]+",";
		nextstep:{	cout<<"this movie:"<<movie[count2]<<" "<<ID2[count2];
			//movie[count2]=movie[count2]+titles;
			system("pause");}
		}



	}

}
Sorry for the complete lack of info. My code is long and I didn't know if you needed or wanted to have to sift through all of that code. This is my entire code for my program.
Pages: 12