954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Array program

Help please, just made this little program, no errors but it does not write any text for me on Dev-C++.

#include <iostream>

using namespace std;

int main()
{
    system("title Array Program.");
    
    int myArray[5];
    int loop;
    
    for (loop = 0; loop > 5; loop++)
    {
        cout << "Value for myArray[" << loop <<"] : ";
        cin  >> myArray[loop];
    }
    
    for (loop = 0; loop > 5; loop++)
    
    cout << "#" << loop << " : " << myArray[loop] << endl;
    
    system("PAUSE>nul");
}


Please help?

Black Magic
Junior Poster
178 posts since Apr 2008
Reputation Points: 25
Solved Threads: 4
 

Change > to < in your loops. You aren't going through them.

VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
 

What is this really doing? for (loop = 0; loop > 5; loop++)

vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228
 

this is not a program i am building on, i am learning C++ and looking at sites trying to learn part by part, then trying to rewrite the program without looking at original to try to learn and remember, and thanks for help

Black Magic
Junior Poster
178 posts since Apr 2008
Reputation Points: 25
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You