Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.149.29.98
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/cjmcgiveron/../mrlong/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/cjmcgiveron/../mrlong/fraction1.cpp
//	p. 116 reducing fraction
//
//
//
//
//

#include <iostream>

using namespace std;

class Fraction
{
	int nume, deno;	// type out full names
public:
	Fraction()	// 0/1
	{	nume = 0; deno = 1;	}
	Fraction( int n, int d )
	{ 	nume = n; deno = d; 	}
	void Set ( int n, int d )
	{	nume = n; deno = d;	}
	void Print() const
	{	cout << nume << '/' << deno;	}
	
};

int main()
{	
	Fraction x;
	//Q: Declare an obj. name y with inital. 0/1
	Fraction y;
	//Q: Decl. an obj. name with ini. 1/2?
	Fraction z ( 1, 2 );
	// Q: Re-set y to 1/3?
	y.Set ( 1, 3);
	//Q: Output y and z?
	y.Print();
	cout << "\n";
	z.Print();

	cout << "\n\nFin.\n\n";
	
	return 0;
}





Stv3n404 - 2023