I'm just starting my first C++ class and have a very basic question. We are to write a program that is going to be using the pow10(int m) function and we are not to use the pow10 function from the math library. I'm unfamiliar with the function so wrote a simple program to see it's output. I am receiving the following error however.
" An Access Violation (Segment Fault) raised in your program."
If anyone can explain what's causing this I would greatly appreciate it :)
" An Access Violation (Segment Fault) raised in your program."
If anyone can explain what's causing this I would greatly appreciate it :)
Code:
#include <iostream> #include <cstdlib> using namespace std; int pow10(int m); //function prototype int main() { int num, ans; cout<<"Enter an integer: "; cin>>num; ans = pow10(num); cout<<"The 10th power of "<<num<<" is "<<ans<<endl; system("PAUSE"); return 0; } int pow10(int m) { int result; result = pow10(m); return result; }
Comment