#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int a,b,n=1,puterea=a;
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;
while(n<=b){
puterea=puterea*a;
n++;
}
cout<<a<<"^"<<b"="<<puterea; *************
return 0;
}
So i ve just started learning C++ and i'm encountering some problems;
At the row with the stars i get the error = "Expected ; before string constant"
You forgot << between b and "=".
Nvm,fixed it ,but now it wont give me the right numbers, I have to calculate a^b;
i get weird numbers like 4564460
You assigned a
to puterea
before a
becomes valid.