.


:




:

































 

 

 

 


Void error_message(int error_code)




{

Switch(error_code)

{

case 1:

printf(\n Message 1); break;

case 2:

printf(\n Message 2); break;

case 5:

printf(\n Message 5); break;

default:

printf(\n Invalid code error);

}

}

goto

goto .

:

Goto ;

Goto backend;

backend:x+=3;

go to.

- ;

- if else, if else, switch;

- .

( ) . , . : while, do while, for.

while ()

While (-)

. 0, ( ). , , , , , , 0 .

while :

1. 0 ;

2. break;

3. return.

1., 2. , . 3. .

1.

Main()

{

int i=4;

while(i>0)

printf(\n C++ \n);

}

. i.

2.

Main()

{

int j=5;

while(j=5)

{

printf(\n j=5\n); j++;

}

} //. =, = =

3.

printf(\n yes no (y/n):);

scanf(%c,&ch);

while(ch!=y&&ch!=n)

{

printf(\n yes no (y/n):);

scanf(%c,&ch);

}

4

while (index<size&&data[index]!=key)

index++;

return(data[index]= =key)?index:-1;

, key data, 1, .

do while

Do

While (-);

do while , 0 (). while:

#include <stdio.h>

Main()

{

extern int compare(char str1[],char str2[]);

char str1[80],str2[80];

printf(\n :);

scanf(%s,str1);

printf(\n :);

scanf(%s,str2);

if (compare(str1,str2)<0)

printf(\n\n );

else if (compare(str1,str2)= =0)

printf(\n\n );

Else

printf(\n\n );

}

int length(char str[])

{

int index=0;

while (str[index++]!=0);

Return - - index;

}

int compare(char str1[],str2[])

{

extern int length(char str[]);

int len1=length(str1);

int len2=length(str2);

int index=-1;

Int minlength;

minlength=(len1<len2)?len1:len2;

Do

index++;

while (index<minlength&&str1[index]= = str2[index]);

if (len1= = len2&&str1[index] = = str2[index]) return 0;

else if (len1< len2&&str1[index] = = str2[index]) return -1;

else if (len1> len2&&str1[index] = = str2[index]) return 1;

else if (str1[index] < str2[index]) return -1;

Else return 1;

}

for

.

:

for ([ 1];[ 2];[ 3])

;

. , :

1 ;

2 . ( );

3 .

for :

1. 1;

2. 2. 0, , .

3. ;

4. 3;

5. 2.

. continue 4.

for while





:


: 2016-11-12; !; : 348 |


:

:

, .
==> ...

802 - | 694 -


© 2015-2024 lektsii.org - -

: 0.014 .