.


:




:

































 

 

 

 


6




#include <cstdio>

#include <cstdlib> //

#include <iostream>

using namespace std;

/****************************************************************

*

* : 'atof' 'gets'

* , .

* : 16/05/2010

*

****************************************************************/

 

int main(){

char str1[80], str2[80]; /* 2 */

double result; /* */

puts (" This program will multiply two floating point numbers .");

/* */

puts (" Please enter the first number .");

gets( str1 );

puts (" And the second.");

gets( str2 );

 

/* */

result = atof( str1 ) * atof( str2 );

/* -> : 8 (2 ) */

printf("Answer is %8.2f\n ", result );

/* */

getchar();

return 0;

}

: , , , .

7.

 

# include <string>

#include <cstdio>

#include <cstdlib> //

 

int main(){

//

char str[255];

 

// - 256

const int size_counter = 256;

 

// -

int counter[size_counter] = {0};

int i;

 

puts ("Enter a string:");

gets (str);

 

// str -

for (i = 0; str[i]; i++)

 

// str[i] - i-

// 1

counter[str[i]]++;

 

/* */

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

 

//

if(counter[i])

 

// %3c - , %d -

printf("%3c - %d\n", i,counter[i]);

 

gets(str);

return 0;

}

 

,

:

, .

(getchar()) .

isdigit(sym).

 

8.

 

//
#include <cstdio>


int main (){
FILE *f; //
char sym; //

 

// "tenlines.txt"
f = fopen ("tenlines.txt","wt");


do {

 

//
sym = getchar ();

 

//
putc (sym,f);


} while (sym!= '\n'); // ENTER ('\n')


fclose (f);
return 0;
}

 

: tenlines.txt

 





:


: 2015-09-20; !; : 311 |


:

:

.
==> ...

1588 - | 1565 -


© 2015-2024 lektsii.org - -

: 0.009 .