I'm transitioning from C to C++ and am apparently having issues with certain things. In my C code, I have something that looks like this:
How would I do the same in C++? I tried using cin << grid[y][0] << grid[y][1], but if I type "lolol" or something it doesn't read the data the way I want it to.Code:char grid[2][2]; for(int y=0; y<2; y++) { while(scanf("%c %c", &grid[y][0], &grid[y][1]) != 2) { printf("Please format your input as 2 characters separated by a space\nPress a key to try again\n"); getch(); } }



LinkBack URL
About LinkBacks



