Trying to make a program that can find exponents...

Ok, I am trying to compile a program that can find the exponent of a number. However, I get a few errors when I try to compile. Here is the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main ()
{
  string mystr;
  double param, result;
  
  printf ("Enter the number: " );
  getline (cin,mystr);
  stringstream(mystr) >> num;
  
  printf ("Enter the exponent: ");
  getline (cin,mystr);
  stringstream(mystr) >> exp;
  result = pow (num,exp);
  
  printf ("The exponent is %lf\n", result);
  system("pause");
  return 0;
}

If you can find what's wrong, I would greatly appreciate it if you could tell me what, and how I can fix it. Thanks in advance.
i think you miss to declare num and exp
Not really a mis-declaration...more a lack of one.
Why are you mixing std::getline() and printf()?
that what you call hybrid. LOL
Last edited on
I call it schizophrenic.
Topic archived. No new replies allowed.