[Solved] Plotting points using Nested For Loops


The solution is exactly as ‘@Lightness Races in Orbit’ just explained to you. Let me add that if the requirement is just print out what you showed us, then no need for the last ‘*’ nor the ‘cin.get()’:

for (int x = 0; x <= n; ++x)
{
    for (int y = 0; y < x; ++y) {
        cout << "*" ;
    }
    // No need for all the rest just print 'new line'
    std::cout << "\n";
}

Try it live!

1

solved Plotting points using Nested For Loops