Start New Discussion within our Software Development Community
#include <iostream>
#include <cmath>
using namespace std;

float scale (float,int) ;
int main()
{
    float num1;
    int num2 ;
    cout << "Enter a real number : " ;
    cin >> num1;
    cout << " Enter an integer: " ;
    cin >> num2;
    cout << " Result of call to function scale is "
    << scale (num1,num2)
    << endl;
    return 0;
}
float scale ( float x, int n)
{
      float scaleFactor;
      scaleFactor = pow(10, n );
      return (x * scaleFactor);
}

the problem is : " 22 C:\Documents and Settings\QuynhlNguyen\My Documents\Final\scale.cpp call of overloaded `pow(int, int&)' is ambiguous "

#include <iostream>
#include <cmath>
using namespace std;

float scale (float,int) ;
int main()
{
    float num1;
    int num2 ;
    cout << "Enter a real number : " ;
    cin >> num1;
    cout << " Enter an integer: " ;
    cin >> num2;
    cout << " Result of call to function scale is "
    << scale (num1,num2)
    << endl;
    return 0;
}
float scale ( float x, int n)
{
      float scaleFactor;
      scaleFactor = pow(10, n );
      return (x * scaleFactor);
}

the problem is : " 22 C:\Documents and Settings\QuynhlNguyen\My Documents\Final\scale.cpp call of overloaded `pow(int, int&)' is ambiguous "

There is no pow (int, int). Try making it pow (10.0, n) instead of pow (10, n)

This question has already been answered. Start a new discussion instead.