cplusplus.com
C++ : Forum : Beginners : Functions
 
cplusplus.com
Information
Documentation
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs


question Functions

Andrew1990 (5)
#include <stdio.h>
#include <math.h>
#include <conio.h>

void main(void)
{float x,w;const float a=2;
clrscr();
printf("Culege valoarea lui x:\n");
scanf("%f",&x);
if(x>a)w=x*(pow(x-a)/1/3);
else if(x==a)w=x*(sin(a*x));
else w=exp(-a*x)*cos(a*x);
printf("x=%f,w=%f",x,w);
getch();
}



What did I made wrong in this program?
I can't fix one error
R0mai (638)
1. main returns int
2. pow() takes two arguments
3. clrscr() and getch() are not standard

http://www.cplusplus.com/reference/clibrary/cmath/pow/
Andrew1990 (5)
Should i replace pow with sqrt?...I have radical of 3 degree....I don't speak very well english
so appologize for mistakes
Topic archived. No new replies allowed.