#(nimsy) c++ hw assignment (drawing circles and rectangles in pgm files)
24 messages · Page 1 of 1 (latest)
(nimsy) c++ hw assignment (drawing circles and rectangles in pgm files)
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>
for some reason, this is wrong?
if (shape != "rect" || shape != "circle") {
cout << "Invalid shape specified! Try again.\n";
continue;
}
even if i type the words "rect" or "circle" it works
but if i remove the ||, it works fine individually and idk why
#include <iostream>
using namespace std;
const int IMG_WIDTH = 800;
typedef uint8_t byte;
enum Coordinate { X, Y };
struct Color {
int foreground = 255;
int background = 0;
};
//main
int main() {
string shape;
string filename;
while (true) {
cout << "Enter a shape (or 'q' to exit)." <<
"\nOptions: circle, rect" <<
"\nInput: ";
cin >> shape;
if (shape == "q") {
cout << "Exiting program.";
break;
}
if (shape != "rect" || shape != "circle") {
cout << "Invalid shape specified! Try again.\n";
continue;
}
cout << "Enter filename or leave blank for default." <<
"\nInput: ";
cin >> filename;
if (filename == "") {
filename = shape;
}
// std::cout << "your input was " << filename << "\n";
}
return 0;
}
this is what i have rn