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

Discussion in 'Computer Programming, Emulation, and Game Modding' started by Nyap, May 30, 2016.

Thread Status:
Not open for further replies.
  1. Nyap
    OP

    Nyap HTML Noob

    Banned
    2
    Jan 13, 2016
    That Chaos Site
    I haven't finished it yet but I just wanted to know why I'm getting this error:
    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, May 30, 2016
  2. Nyap
    OP

    Nyap HTML Noob

    Banned
    2
    Jan 13, 2016
    That Chaos Site
    holy fuck i am stupid
    i put if instead of for
    mods feel free to delete this post
     
Loading...
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice