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

Status
Not open for further replies.

Nyap

HTML Noob
OP
Banned
Joined
Jan 13, 2016
Messages
971
Trophies
0
Age
55
Location
That Chaos Site
XP
483
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

General chit-chat
Help Users
  • K3Nv2 @ K3Nv2:
    Taco Saturday
  • AncientBoi @ AncientBoi:
    Uhh, It's 🌯 Saturday dude. :) js
  • BigOnYa @ BigOnYa:
    Nope that for tomorrow, cinco de mayo, today is bbq chicken on the grill.
  • K3Nv2 @ K3Nv2:
    Juan's new years I forgot
    +2
  • AncientBoi @ AncientBoi:
    :hrth::toot::grog::grog::grog::bow: HAPPY BIRTHDAY to me :bow::grog::grog::toot::hrth:
  • K3Nv2 @ K3Nv2:
    One day away from Juan's birthday
  • K3Nv2 @ K3Nv2:
    Only if you send him feet
    +1
  • BigOnYa @ BigOnYa:
    Happy birthday!
    +1
  • AncientBoi @ AncientBoi:
    Thank You :D
  • realtimesave @ realtimesave:
    heh I got a guy who created an account just yesterday asking me where to find mig switch roms
  • realtimesave @ realtimesave:
    too much FBI watching this website to answer that kind of question lol
  • K3Nv2 @ K3Nv2:
    Has the mig switch found loopholes without requiring game keys?
  • Xdqwerty @ Xdqwerty:
    @AncientBoi, happy birthday
  • Xdqwerty @ Xdqwerty:
    Yawn
  • Xdqwerty @ Xdqwerty:
    Lonely here
  • Xdqwerty @ Xdqwerty:
    Anybody?
  • Psionic Roshambo @ Psionic Roshambo:
    I want my money back... Drug test? No drugs to test but they want me to pee in a cup! Lol
  • K3Nv2 @ K3Nv2:
    Better call Pedro you're up in smoke
    +2
  • C @ Clayton44333:
    hey any1 know if there is a new version of the ps4 homebrew store ?
  • Xdqwerty @ Xdqwerty:
    Finally there are people here
  • K3Nv2 @ K3Nv2:
    We're figments of your imagination
    +1
    K3Nv2 @ K3Nv2: We're figments of your imagination +1