-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanny.cpp
More file actions
44 lines (37 loc) · 968 Bytes
/
manny.cpp
File metadata and controls
44 lines (37 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
int main(void) {
int width;
int height;
std::cout << "Enter the width in pixels: ";
std::cin >> width;
std::cout << "Enter the height in pixels: ";
std::cin >> height;
const int resolution = height*width;
std::cout << width << "x" << height << std::endl;
bool *pixels[resolution];
for (int i = 0; i < resolution; i++) {
pixels[i] = new bool;
}
std::cout << "Enter the string of pixels. 0 for black; 1 for white. " << std::endl;
for (int i = 0; i < resolution; i++) {
bool temp;
std::cin >> temp;
*pixels[i] = temp;
}
for (int i = 0; i < resolution; i++) {
if (i%width == 0 && i != 0) {
std::cout << std::endl;
}
if (*pixels[i] == 1) {
std::cout << "";
} else {
std::cout << "";
}
}
std::cout << std::endl;
for (int i = 0; i < resolution; i++) {
delete pixels[i];
}
// std::cout << "" << "&" << "" << std::endl;
return 0;
}