here is what I have so far, I think i have a decent grasp of the pad panel and maybe crop and what to do but the wrtire create and rotation functions elude me . instructor told us to use fstream on the write function but im not sure how to do that, and the lecture notes don’t cover it. do i need to have a specific file in mind or is there a way to get it to open any file. here’s the hot mess i have so far. the read function was already made for us so it should not need changing
#include “pgm.hpp”
#include
#include
#include
#include
#include
#include
#include
using namespace std;
bool Pgm::Read(const std::string &file)
{
ifstream fin;
string s;
size_t i, j, r, c, v;
fin.open(file.c_str());
if (fin.fail()) return false;
if (!(fin >> s)) return false;
if (s != “P2”) return false;
if (!(fin >> c) || c <= 0) return false;
if (!(fin >> r) || r <= 0) return false;
if (!(fin >> i) || i != 255) return false;
Pixels.resize(r);
for (i = 0; i < r; i++) {
Pixels[i].clear();
for (j = 0; j < c; j++) {
if (!(fin >> v) || v > 255) return false;
Pixels[i].push_back(v);
}
}
if (fin >> s) return false;
fin.close();
return true;
}
bool Pgm::Write(const std::string &file) const
{
int i, j;
fprintf(stderr, “P2n”);
fprintf(stderr, “%d %dn”, Pixels[0].size(), Pixels.size());
fprintf(stderr, “255n”);
int count=0;
for (i=0; i< Pixels.size() ; i++){
for (j = 0; j < Pixels[0].size(); j++){
temp = image[i][j];
fprintf(stderr, “%d”, temp);
}
fprintf(stderr, “n”);
}
return 0;
}
bool create(size_t r, size_t c, size_t pv);
{
}
bool Clockwise(){
}
bool cClockwise(){
}
bool Pgm::Pad(size_t w, size_t pv)
{
(void)w;
(void)pv;
return false;
}
bool Pgm:Panel(size_t r, size_t c)
{
(void)r;
(void)c;
return false;
}
bool Pgm::Crop(size_t r, size_t c, size_t rows, size_t cols)
{
(void)r;
(void)c;
(void)rows;
(void)cols;
return false;
}
any help would be greatly appreciated mostly concerenced about wrtie, create, and the rotation functions
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more