:
#include <math.h>
#include "stdafx.h"
#include <iostream>
#include <conio.h>
void main()
{
float a,b,x,y;
printf("Enter a and b");
scanf("%e",&a);
scanf("%e",&b);
x=sin(a)+cos(2*b-a)/cos(a)-sin(2*b-a)
y=1+sin(2*b)/cos(a)-sin(2*b-a);
printf("Answer x: %e",&x);
printf(" Answer y: %e",&y);
getch();
return 0;
}
- :
:
1. printf().
printf() . , , ...
printf() stdio.h
printf() .
: , , , , .
printf() . , , . . % .
1
% | |
%d | |
%i | |
%e | x.xx e+xx |
%E | x.xx E+xx |
%f | xx.xxxx |
%F | xx.xxxx |
%g | %f %e, |
%G | %F %E, |
%o | |
%s | |
%u | |
%x | |
%X | |
%% | % |
%p | |
%n |
2. scanf() - . (). , , , .
scanf() stdio.h
.
: , . %.
2 -
%c | |
%d | |
%i | |
%e | float ( ) |
%h | short int |
%o | |
%s | |
%x | |
%p | |
%n |
3. getch(); : conio.h
getch() , , .
|
|
,
.
, , .
- , , .
- : , , - , ( - ).
- . , , , .
:
, , , , . , , .
, .
.
:
, - ;
, , - . .
.
, , , . . . , , , . , .
,
.
, , .
- , , .
- : , , - , ( - ).
- . , , , .
:
, , , , . , , .
|
|
, .
.
:
, - ;
, , - . .
.
, , , . . . , , , . , .
2
1. F Xs Xf dx, a,b,c,Xs,Xf,dx .
:
#include "stdafx.h"
#include <conio.h>
#include <math.h>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{float F,a,b,c,Xs,Xf,dX,x;
printf("Enter a b c Xs Xf dX \n");
scanf("%f%f%f%f%f%f",&a,&b,&c,&Xs,&Xf,&dX);
for(x=Xs; x<Xf; x+=dX)
{ if (a<0 && x!=0)
{
F=a*(pow(x,2))+(b*x)+c;
printf("Answer F: %f",F);
}
else if(a>0 && x==0)
{
F=(-a)/(x-c);
printf(" Answer F: %f",F);
}
else
{
F=(x/c)-3;
printf(" Answer F: %f",F);
}
}
getch();
return 0;
}
- :
:
if
- C++ if, :