I have a file that is representing an image, here's the puddle.img file:
10 22
2222888222882222228882
2222888222882222228882
3333333333333333333333
1111111111111111111111
1111144444111111111111
1111444444411551111111
1114643434345551111111
1111333333311551111111
1111133333111111115114
1111111111111111115543
The first two numbers are the size of the image, rows and then columns. Then I have to pull in the image, and before the user sees it, it is rendered, such as a 0 = a space, 1 = -, 2 is =, 3 is a O and so forth. So they'll see this after they enter the name of the image file:
====WWW===WW======WWW=
====WW===WWWW=====WWW=
OOOOOOOOOOOOOOOOOOOOOOOO
-------------------------------------------
-----ZZZZZ------------------------------
----ZZZZZZZ--XX-----------------------
---ZBZOZOZOXXX----------------------
----OOOOOOO--XX---------------------
-----OOOOO------------------------X--Z
-------------------------------------XXZO
Basically 1-9 each mean something else when rendered before outputting to the screen.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
string filename;
int rows;
int cols;
int k = 0;
int m = 0;
string row;
const int ROW_SIZE = 40;
const int COL_SIZE = 70;
int image [ROW_SIZE][COL_SIZE];
int main()
{
ifstream inFile;
cout << "Enter image file name:" << endl;
getline(cin, filename);
inFile.open(filename.c_str());
return 0;
}
I tried messing with a getline to get the row and column number, but getline can't be used with integers, then if I use a cin I think it gets stuck on whitespace and just sits there.