this is my code but it doesnt want to work right lol
its very basic
but if someone could help me i would appreciate it
#include %26lt;iostream%26gt;
using namespace std;
int main(void)
{
double dfirst;
double dsecond;
double dnum1;
double dnum2;
int answer;
{
cout %26lt;%26lt;"enter your first number" %26lt;%26lt; endl;
cin %26gt;%26gt; dfirst;
}
{
cout %26lt;%26lt; "enter your second number which needs to be less than the first"%26lt;%26lt; endl;
cin %26gt;%26gt; dsecond;
}
(dfirst / dsecond == dnum1);
(dsecond + dnum1 == dnum2);
(dnum2 / 2 == answer);
{
cout %26lt;%26lt; answer %26lt;%26lt; endl;
}
system("pause");
return 0;
}
C++ square root calculator?
ok , there is alil problem u ddnt notice may b , that :
in C , the symbol == is called the equlity operator. Recall that the symbol = is called the assignment operator.Remember that the eulity operator, == , determines where two expressoins are equal , that gives u a result of true or fales, only , but the assignment operator ,=, assigns the value of an expression to a variable. And all u need here is the assigmnemt operator not the equality one, so ur code is gonna be like:
# include %26lt;iostream%26gt;
using namespace std;
int main(void)
{
double dfirst;
double dsecond;
double dnum1;
double dnum2;
int answer;
{
cout%26lt;%26lt;"enter your first number"%26lt;%26lt;endl;
cin%26gt;%26gt;dfirst;
}
{
cout%26lt;%26lt;"enter our second number which needs to be less than the first"%26lt;%26lt;endl;
cin%26gt;%26gt;dsecond;
}
(dnum1=dfirst/dsecond);//16
(dnum2=dsecond+dnum1);//3
(answer=dnum2/2);
{
cout%26lt;%26lt;answer%26lt;%26lt;endl;
}
system ("pause");
return 0;
}
and ur square root calculater will work , enshallah.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment