C++ Structures program

Hi all, for this program it has to display the stored information in the array and the information the user enters into the getInfo function. This is what I have so far:
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
  
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

const int SIZE = 3;			//the size of the arrays


struct BookInfo
{
	string title;			//title of book
	double price;			//price of book
};

struct Author
{
	string name;			//author of book
	BookInfo books;			//array that holds 3 books the author has written
};
//a[];

void showInfo(Author[], int);
void getInfo(Author[], int);

int main()
{
	Author a[SIZE] = { {"NONE", {"NONE", 0}},
					   { "NONE",{ "NONE", 0 }},
					   { "NONE",{ "NONE", 0 }}
	};

	cout << "Here is the data after initialization" << endl;
	showInfo(a, SIZE);
	cout << endl;

	cout << "Get user's input" << endl;
	getInfo(a, SIZE);
	cout << endl;

	showInfo(a, SIZE);
	cout << endl;

	system("pause");
	return 0;
}


//**************************************************
//*This function displays the information stored   *
//*in a[]                                          *
//**************************************************
void showInfo(Author a[], int size)
{
	for (int i = 0; count < size; i++)
	{
		cout << "The author: " << a[i].name << endl;
		for (int j = 0; j < size; j++)
		{
			cout << "\tThe title: " << a[j].books.title << ", the price: $" << a[j].books.price << endl;
		}
		
	}
}

//**************************************************
//*This function gets array information from the   *
//*user                                            *
//**************************************************

void getInfo(Author a[], int size)
{

	for (int i = 0; i < size; i++) {
		cout << "Enter the author's name: ";
		getline(cin, a[i].name);

		for (int j = 0; j < size; j++) {
			cout << "Enter the title " << (j + 1) << " :";
			getline(cin, a[j].books.title);

			if (a[j].books.title != "NONE")
			{
				cout << "Enter price " << (j + 1) << " :$";
				cin >> a[j].books.price;
				cin.ignore();
			}
			else
				break;
		}
		cout << endl;
	}
	cout << endl;
}

I am not sure why I am getting almost 20 syntax errors on my first for loop (lines 56-62) and also lines 65-73. Does this code work for anyone else?
I appreciate your help on this, this is my first c++ class.
Last edited on
line 56 - count isn't defined here, did you mean to use i?
Lol dammit, thanks for the catch! So I fixed that but this is the output I'm getting now: the getInfo function keeps writing over my last iteration. It also doesn't keep asking for the author's name after each section. Any ideas?


Get user's input
Enter the author's name: jk rowling
Enter the title 1 :harry potter
Enter price 1 :$50
Enter the title 2 :fantastic beast
Enter price 2 :$50
Enter the title 3 :peak
Enter price 3 :$20

Enter the author's name: roland smith
Enter the title 1 :peak
Enter price 1 :$20
Enter the title 2 :harry potter
Enter price 2 :$50
Enter the title 3 :fantastic beasts
Enter price 3 :$50

Enter the author's name:  

Topic archived. No new replies allowed.