Ok, I'm going to explain this once. Please put any code you post into [
code][/code] tags, it will format your code and keep you indentation and make it much easier to read.
Why are you using filestream? The idea behind filestream is to save the work someone did in your program this time, for next time. It looks like you're trying to use it for a storage center. That is a no no.
Filestream takes up a lot of memory when you constantly open and close files. This will slow your computer down.
In Cottages(), you have the function scope and a completely seperate scope, only one is required:
1 2 3 4
|
void Cottages(reserve temp[], int ColLetter, int NumRows,int snum)
{
{
|
What are you trying to do on this line?:
1 2
|
for(temp[i].cnumber=0; temp[i].cnumber < 5; temp[i].cnumber++)
fout<<setw(14)<<letter.at(temp[i].cnumber);
|
Here, you open the same file twice:
1 2
|
fin.open("cottages.txt");
ifstream instream("cottages.txt");
|
You also never close the fin. This can cause issues.
This isn't right:
reserve c[100];;
Here, you declare 1-40 cottages, but in the very beginning of the function you created an array of 100, why?:
|
cout<<"\nHow many cottages would you like to Reserve? [1-40] : ";
|
It looks like you made a good attempt at using the arrays, but it's hard to understand the array of cottages, not your fault. However, it's very hard to test it with only two sections. Make it easy on me and post your entire code between code tags and I'll go through it line by line to see what the issue is.
Also, if you plan on using filestream, make a read() and write() function. Outside of here, there should be
NO other filestream calls. I would also only use the write function right before the program closes. Think about notepad, what would happen to your computer if it closed down the file and reopened it every time you typed 1 letter?