People, hello. Please, help me!
Posted by
vadimka 27 Feb 2008 16:33
I don't understand this system. It writes: "wrong answer". Who can talk me what's wrong with my program:
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void f()
{
float d;
if (!(cin >> d)) return;
f();
d = sqrt(d);
cout.precision(4);
cout << d;
cout << "\n";
}
void main()
{
f();
}
Thank you very much!
Re: People, hello. Please, help me!
Change this :{cout.precision(4);
cout << d;
cout << "\n";}
to:printf("%.4lf\n",d);
Re: People, hello. Please, help me!
Posted by
vadimka 27 Feb 2008 18:58
It doesn't work too! (((
Re: People, hello. Please, help me!
make an array[1000000] of __int64
then reverse it and print!!!
May be there is another better solution, but this work's!!!
Re: People, hello. Please, help me!
Posted by
Gomer 4 Mar 2008 15:26
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void f()
{
double d;//!
if (!(cin >> d)) return;
f();
d = sqrt(d);
cout << d;
cout << "\n";
}
//!
#pragma comment(linker, "/STACK:16777216")
int main()
{
cout.setf(ios::showpoint | ios::fixed);//!
cout.precision(4);
f();
return 0;
}
It works!
Edited by author 04.03.2008 15:28
Edited by author 04.03.2008 15:29