[C++] What's wrong with my program

  • Thread starter Thread starter Nyap
  • Start date Start date
  • Views Views 771
  • Replies Replies 1
Status
Not open for further replies.

Nyap

HTML Noob
Banned
Joined
Jan 13, 2016
Messages
971
Reaction score
347
Trophies
0
Age
57
Location
That Chaos Site
XP
529
Country
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,
Status
Not open for further replies.

Site & Scene News

Popular threads in this forum