| | |
C++ Array
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
I hope this is not homework! That would be cheating!
This will do something like that, learn from it:
[php]
#include <iostream>
#include <iomanip> // for setw()
#include <stdlib.h> // for system()
using namespace std;
int main()
{
int k;
int scores[50]; // array to hold 50 integers
// initialize the array
for(k = 0; k < 50; k++)
scores[k] = 75;
// test it
for(k = 0; k < 50; k++)
cout << scores[k] << setw(8);
cout << endl;
system("PAUSE"); // wait
return 0;
}
[/php]
This will do something like that, learn from it:
[php]
#include <iostream>
#include <iomanip> // for setw()
#include <stdlib.h> // for system()
using namespace std;
int main()
{
int k;
int scores[50]; // array to hold 50 integers
// initialize the array
for(k = 0; k < 50; k++)
scores[k] = 75;
// test it
for(k = 0; k < 50; k++)
cout << scores[k] << setw(8);
cout << endl;
system("PAUSE"); // wait
return 0;
}
[/php]
May 'the Google' be with you!
![]() |
Similar Threads
- Can I ghost a RAID array??? (Windows NT / 2000 / XP)
- Creating dynamic array structures (C++)
- Array limit (C)
- struct dynamic 2d array alloc (C)
- string to integer array transformation (C)
- Array (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: c++ arrays, help identify element place
- Next Thread: C++ strcmp
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






