Server IP : 172.16.15.8 / Your IP : 3.22.70.169 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 112 Computer Programming Assignment 8 // // File: hw8.cpp // Author: Katie Buck // Instructor: Dr. Wang // // Compile: g++ hw8.cpp // Run: ./a.out < in8.txt > out8.txt // // Goal: The goal of this program is to read the numbers from a // file and output the square and square-root to one decimal place // for each number to a file named out8.txt. // #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { cout << fixed << showpoint << setprecision(1); int n; float square; float root; cin >> n; while(cin) { square = n*n; root = sqrt(n); cout << square << endl; cout << root << endl; cin >> n; } return 0; }