School-Coding-Cpp/funzioni/potenze.cpp

27 lines
658 B
C++

/*
AUTORE: Manuel Vichi
Potenze
Work in Progress: Fare in modo che +1 mostri il segno
*/
#include <iostream>
#include <array>
#include <vector>
#include <cstdlib>
using namespace std;
int potenzaInteri(int base, int esponente) {
return base^esponente;
}
float potenza(float base, float esponente) {
return (float)base^esponente;
}
unsigned int potenzaNaturale(unsigned int base, unsigned int esponente) {
return base^esponente;
}
int main() {
cout << "Potenza intera: " << potenzaInteri(-2,3) << endl << "Potenza float: " << potenza(2.0f,5.9f) << endl << "Potenza naturale: " << potenzaNaturale(5,7) << endl;
return 0;
}