.


:




:

































 

 

 

 


.




 

. . , , .

, . , , , . , , , , Exel-.

. , , .

 

 

1 / / . , / . : ?

24 , .

: 1 , 2 0 . , Out.txt 0 9. , Out.txt nArray.

31

/* */

#include <fstream.h> //

void main(void)

{

int nKey; // , :

// ,

int nArray[10]; //

 

//

while (nKey!= 0)

{

// : 1 , 2 0

cout << "Enter 0 for exit, 1 for write and 2 for read\n";

cin >> nKey;

int i;

if (nKey == 1) //

{

// out.txt

ofstream OutFile("out.txt");

for (i = 0; i < 10; i++)

{

OutFile << i <<"\n"; //

}

OutFile.close(); //

} else if (nKey == 2) //

{

// out.txt

ifstream InFile("out.txt");

for (i = 0; i < 10; i++)

{

// nArray

InFile >> nArray[i];

//

cout << nArray[i] << '\n';

}

InFile.close(); //

}

}

}

 

 

1 , / , / , . 24 .

.

:

 

// out.txt

ofstream OutFile("out.txt");

for (i = 0; i < 10; i++)

{

OutFile << i <<"\n"; //

}

OutFile.close(); //

 

ofstream OutFile("out.txt"). , . , ("out.txt") , ofstream , OutFile ofstream. , , ofstream , , OutFile . , ofstream , int, double, char bool, .

, ofstream (output file stream) , . int nNum, nNum, ofstream OutFile OutFile. ("out.txt") .. out.txt. , . , .

cout << . 1 , , . , .

ofstream , . OutFile.close().

. 24 :

 

// out.txt

ifstream InFile("out.txt");

for (i = 0; i < 10; i++)

{

// nArray

InFile >> nArray[i];

//

cout << nArray[i] << '\n';

}

InFile.close(); //

 

ifstream (input file stream) , . InFile out.txt.

InFile >> nArray[i], .

24, .

-, , , , nArray .

-, . 10 , 11, 11- nArray .

, .

 

 

1. : y = x 2. [ a, b ] Δ x = (b - a)/10. . .

 

.

 

32

/* */

#include <fstream.h>

#include <math.h>

void main(void)

{

//

double dA, dB, dDeltaX;

//

cout << "Please input a, b (b > a)\n";

cin >> dA >> dB;

//

if (dB <= dA)

{

cout << "Wrong inteval\n";

return;

}

//

dDeltaX = (dB - dA)/10.;

//

ofstream OutFile("function.txt");

for (int i = 0; i <= 10; i++)

{

//

OutFile << dA + i * dDeltaX << \t << pow(dA + i * dDeltaX, 2) <<"\n";

}

//

OutFile.close();

}

 

 

function.txt:

 

0 0

0.2 0.04

0.4 0.16

0.6 0.36

0.8 0.64

1 1

1.2 1.44

1.4 1.96

1.6 2.56

1.8 3.24

2 4

 

:

. 18

 


 

2. , .

 

.

 

33

/* */

#include <fstream.h>

void main(void)

{

//

double nArray[11][2];

//

ifstream InFile("function.txt");

for (int i = 0; i <= 10; i++)

{

//

InFile >> nArray[i][0];

//

InFile >> nArray[i][1];

//

cout << nArray[i][0] << \t << nArray[i][1] << "\n";

}

//

InFile.close();

}

 

 


5

 

1. f (x) [ a, b ] Δ x = (b - a)/10. . 5.1. .

 

! , .

! 1/ a a ≠ 0.

 

2. , .

 

.

 

! , , .

 


 

5.1. 1

           
     
     
     
     
     
     
       

 

 

1. . ?

2. . ?

 


8

 

: .

 

:

1) .

2) .

 





:


: 2016-11-18; !; : 492 |


:

:

, .
==> ...

1540 - | 1394 -


© 2015-2024 lektsii.org - -

: 0.034 .