I haven't finished it yet but I just wanted to know why I'm getting this error:
/home/nyap/Projects/6.9a comprehensive quiz/main.cpp|20|error: expected ‘)’ before ‘;’ token|
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
int numberOfNames;
while (numberOfNames<0)
{
cout << "How many names do you want to enter?";
cin >> numberOfNames;
if (numberOfNames>=0)
{
break;
}
cout << "Invalid input! Make sure to enter a positive integer.\n";
}
string *names{new string[numberOfNames]};
if (int CurrentlyEntering{1}; CurrentlyEntering<(numberOfNames+1); ++CurrentlyEntering) // line 20 is this
{
cout << "Name #" << CurrentlyEntering << ": ";
cin >> names[CurrentlyEntering-1];
}
return 0;
}
Last edited by Nyap,