(New page: Category:MA453Spring2009Walther I wrote a program in C++ to calculate the numbers generated for a ( a.k.a <a>={ A, ... , B }) I can send you the program if you want it. My email is tm...)
 
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:MA453Spring2009Walther]]
 
[[Category:MA453Spring2009Walther]]
 +
[[Category:MA375]]
 +
[[Category:math]]
 +
[[Category:discrete math]]
  
 +
=Program for Generators=
 +
[[MA375]], Spring 2009, Prof. Walther
 +
----
 
I wrote a program in C++ to calculate the numbers generated for a ( a.k.a <a>={ A, ... , B }) I can send you the program if you want it. My email is tmcqueen@purdue.edu. Here is the code for it though. The Number of cycles is how many powers will be generated. Im sure there are better ways to do some of the stuff I just don't know them. And there is a limitation to the program. If numbers get to large the program can't use them(i.e. 13^15 will most likley give problems). It has to do with data types, and what the operations can be done to them, and how large a data type can be.
 
I wrote a program in C++ to calculate the numbers generated for a ( a.k.a <a>={ A, ... , B }) I can send you the program if you want it. My email is tmcqueen@purdue.edu. Here is the code for it though. The Number of cycles is how many powers will be generated. Im sure there are better ways to do some of the stuff I just don't know them. And there is a limitation to the program. If numbers get to large the program can't use them(i.e. 13^15 will most likley give problems). It has to do with data types, and what the operations can be done to them, and how large a data type can be.
  
 +
-Tyler McQueen
  
 +
<pre>
  
 
#include <iostream>
 
#include <iostream>
Line 53: Line 61:
 
return 0;
 
return 0;
 
}
 
}
 +
</pre>
  
[[Category:MA453Spring2009Walther]]
+
 
 +
Wow!  I just wanted to say wow and thanks for sharing this!  -[[Josie]]
 +
 
 +
----
 +
[[MA375_%28WaltherSpring2009%29|Back to MA375, Spring 2009, Prof. Walther]]

Latest revision as of 07:34, 20 May 2013


Program for Generators

MA375, Spring 2009, Prof. Walther


I wrote a program in C++ to calculate the numbers generated for a ( a.k.a <a>={ A, ... , B }) I can send you the program if you want it. My email is tmcqueen@purdue.edu. Here is the code for it though. The Number of cycles is how many powers will be generated. Im sure there are better ways to do some of the stuff I just don't know them. And there is a limitation to the program. If numbers get to large the program can't use them(i.e. 13^15 will most likley give problems). It has to do with data types, and what the operations can be done to them, and how large a data type can be.

-Tyler McQueen


#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	float base,  cycles, n = 1, t;
	int modulus;

	cout << "Enter generator (a from <a>):";
	cin >> base;
	cout << "\n";

	cout << "Enter modulus:";
	cin >> modulus;
	cout << "\n";

	cout << "Enter number of cycles:";
	cin >> cycles;
    cout << "\n";

while (n-1 < cycles)
{
    long double x;
		x = (pow(base,n));
	int y;
		y=floor(x);
if(x==y)
{
	cout << base << "^" << n << " = " ;
    cout << y%modulus  << endl ;
	//cout << "power=" << n  << endl;
	//cout << "x=" << x  << "  ";
	//cout << "y=" << y  << endl;
	n++;
}
if(x != y)
{
	cout << " Numbers to large\n Last two numbers may not be correct\n\n" << endl;
	n = cycles+1;
}
}
cout << "Enter a number to end porgram:";
cin >> t ;

	return 0;
}


Wow! I just wanted to say wow and thanks for sharing this! -Josie


Back to MA375, Spring 2009, Prof. Walther

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett