Why can I not raise 10 to an exponent k (integer variable) in C++?

4.5
Average: 4.5 (2 votes)
Reputation: 38
Asked 2 years ago.
388 View(s)
Why can I not raise 10 to an exponent k (integer variable) in C++?

I am trying to calculate 10^k in C++, where k is an integer variable that changes through each cycle of a for loop. It tells me however that k has no digits and that it cannot do this.

for (k = 5; k = 0; k = k - 1)
{
power = 1e(1*k);
quotient = product / power; //
cout << quotient << endl;
n[5 - k] = quotient;
product = product - power;
}

This is the section of code. The only error I get is the one mentioned above.

Delivery Time: 1 days.
Question Category: Programming.
Shen Smith
Reputation: 99
Free
Deliver in: 1 hours

Tutor Answer

You must be login to view answer.