J
Jim Langston
Complete compilable code:
#include <iostream>
#include <string>
int main()
{
char nums [ ] [3][5] = { " 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8","
9","10","11","12","13","14","15"};
for ( int i = 0; i < 3; i++)
{
for ( int j = 0; j < 5; j++)
std::cout << nums[j] << " ";
std::cout << std::endl;
}
std::string Wait;
std::cin >> Wait;
}
Output is:
1 2 3 4 5
4 5 6 7 8
7 8 9 10 11
Expected output would be:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
If I change it from char nums [][3][5] to int nums[3][5] and make them ints
in the initialization list, that is indeed my output.
Is this a bug in Microsoft Visual C++ .net 2003 or am I doing something
wrong?
#include <iostream>
#include <string>
int main()
{
char nums [ ] [3][5] = { " 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8","
9","10","11","12","13","14","15"};
for ( int i = 0; i < 3; i++)
{
for ( int j = 0; j < 5; j++)
std::cout << nums[j] << " ";
std::cout << std::endl;
}
std::string Wait;
std::cin >> Wait;
}
Output is:
1 2 3 4 5
4 5 6 7 8
7 8 9 10 11
Expected output would be:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
If I change it from char nums [][3][5] to int nums[3][5] and make them ints
in the initialization list, that is indeed my output.
Is this a bug in Microsoft Visual C++ .net 2003 or am I doing something
wrong?