Server IP : 172.16.15.8 / Your IP : 3.147.65.111 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/kebuck/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// CS 212 Computer Programming II Assignment 7 // Due: Wednesday April 20, 2011 // // File: homework7.cpp // Author: Katie Buck // Instructor: Dr. Wang // // Compile: g++ homework6.cpp // Run: ./a.out < data7.txt // // Goal: The goal is to write a program to read a // a set of pixels from a file to an object // of Pixel class and output the coordinates // length to one decimal place for only the // pixel that is ON. Hand in the code and output // file. #include <iostream> #include<iomanip> using namespace std; #include "point.h" #include "pixel.h" int main() { cout << fixed << showpoint << setprecision(1); Pixel px1(0, 0, OFF); Pixel px2; int a, b; string str; StatusType status; cin >> a >> b >> str; while(cin) { if(str == "ON") { status = ON; // make pixel? px2.Set(a, b, status); cout << "The coordinate is: "; px2.Print(); cout << "\n" << "The distance is: " << px2.Distance(px1)<< "\n\n"; } else if(str == "OFF") { status = OFF; } cin >> a >> b >> str; } cout << "\n\n"; return 0; }