.


:




:

































 

 

 

 


, ctype.h.




.

1. - int toupper(int c)

2. - int isupper(int c)

3. - int tolower(int c)

4. - int islower(int c)

 

#include <ctype.h>

void main(void){

int ch; crit=0; //

while ((ch=getche())!='\n'){

if(crit==0){

ch=isupper(ch)? tolower(ch): ch;

putchar(ch);

}

else{

ch=islower(ch)? toupper(ch):ch;

putchar (ch);

}

}

 

 

- . &. , .

" type" :

type& _ = .

. :

int i = 0;

int& iref = i;

iref int - int* const. . , , , :

iref++; // , i++

int *ip = &iref; // , ip = &i;

, iref i.

, , .

 

#include <iostream.h>

void incr (int&);

void main(void){

int i = 5;

incr(i);

cout<< "i= " << i << "\n";

}

void incr (int& k){

k++;

}

 

, . . .

. - , .

 

 

main() . , - .

int main(int argc, char *argv[]) {}

argc - , .

*argv[] .

argv[0] ;

argv[1] ..

main() , . DOS . 0. IF ERRORLEVEL 0 echo Ok!. , return .

 

#include <iostream.h>

int main(int argc, char* argv[]) {

if(argc<2) {

puts( );

exit(1);

}

else {

cout<< <<argv[0]<<endl;

cout<< <<argv[1]<<endl;

}

return 0;

}

, DOS exit(1).

 

 

 

- . , .

- . : , , , , , , , . . , , , . , .

, . .

:

 

struct book {

char title [81];

char author[30];

float value;

};

 

book .

, , . struct - , book - , , .

 

struct {

char title [81];

char author[30];

float value;

}libry;

 

. .

. , -, , , . , (81).

struct book , int, float .

struct book doyle, panshin;

. , , .

 

void main(void) {

struct book libry; // - book

puts(" ");

gets(libry.title);

puts(" ");

gets(libry.author);

puts(" ");

scanf("%f",&libry.value);

printf("%s, %s, %p.2f",libry.title,libry.author,libry.value);

}

 

:

struct book libry={" ", "..", 1.50};

 

 

, .

 

void main(void){

struct book libry[100];

int i;

for(i=0; i<100; i++){

puts(" ");

gets(libry[i].title);

puts(" ");

gets(libry[i], author);

puts(" ");

scanf("%f",&libry[i].value);

}

}

 

libry[i].

libry[2].title[3] 4- title 3- book.

 

"" , , .

 

struct names{ char name[20];

char fio[20];};

struct worker{ struct names people;

char job[20];

float money;};

void main(void){

struct worker driver = {{"", ""},

"", 1234.1};

 

.

puts(driver.people.name);

 

, . , .

 

struct worker *pdrv;

pdrv = &driver;

struct worker driver[2]; //

 

) pdrv = driver; // pdrv <=> &driver[0];

pdrv+1 <=> &driver[1].

->.

pdrv->job -> driver[0].job ->(*prdv).job

) pdrv->people.name

 

1) .

driver.money=1234;

2) .

pdrv->money=3456;

 





:


: 2016-11-23; !; : 397 |


:

:

, .
==> ...

1655 - | 1476 -


© 2015-2024 lektsii.org - -

: 0.022 .