top of page

소스 코드 제출

공개·회원 52명

250710

/**


c언어에서의 문자열(string) = char 일차원 배열



1. 문자열 선언


char str[10]="";



2. #include <string.h>



3. 문자열 출력


printf("%s",str);



4.문자열 입력 (한 단어)


scanf("%s",str);



5. 문자열 입력 (한 문장, 공백 포함)


gets(str);




&str[0] -> str



&str -> &&str[0] (xxx)



6.


str[0] -> 'h'


str[1] -> 'e'


...


str[5] -> NULL ( 문자열의 끝 )



*/



/*


#include<stdio.h>


#include <string.h>


int main()


{


//char str[50]={'h','e','l','l','o'};


char str[50]="hello";


char str1[50]="";


int i;


// printf("%s\n",str);



// scanf("%s %s",str,str1);


//scanf("%s",str);


//gets(str);


//printf("%s",str);


//printf("%c %c %c %c %c",str[0],str[1],str[2],str[3],str[4]);



scanf("%s",str);


int n = strlen(str);


//printf("%d",n);


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


{


if(str[i]=='a')


{



}


printf("%c",str[i]);


}


return 0;


}


*/



/*


#include<stdio.h>


#include<string.h>


int main()


{


char str[50]="";


scanf("%s", str);


printf("%s", str);



return 0;


}


*/



/*


#include<stdio.h>


#include<string.h>



int main()


{


char str[50]="";


gets(str);


printf("%s", str);



return 0;


}


*/



/*


#include<stdio.h>


#include<string.h>



int main()


{


char str[50]="";


gets(str);


printf("welcome! %s", str);



return 0;


}


*/



/*


#include<stdio.h>


#include<string.h>



int main()


{


char str[50]="";


int i;


gets(str);


for(i=1; i<=str[50]!=0; i++)


{


if(str[i]=='t');


{


printf("%d ", i+1);


}


}



return 0;


}

*/


/*

#include<stdio.h>

#include<string.h>


int main()

{

int i;

char str[50]={};

gets(str);

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

{

if(str[i]=='t')

{

printf("%d ", i+1);

}

}


return 0;

}

*/


/*

#include<stdio.h>

#include<string.h>


int main()

{

int i, res;

char str[1001]={};

gets(str);

res = strlen(str);

// res=0;

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

// {

// res++;

// }

printf("%d", res);

return 0;

}

*/


/*

#include<stdio.h>

#include<string.h>


int main()

{

int i, res=0;

char str[21]={};

gets(str);

res = strlen(str);

for(i=res-1; i>=0; i--)

{

printf("%c", str[i]);

}

return 0;

}

*/


/*

#include<stdio.h>

#include<string.h>


int main()

{

int i, res=0;

char str[21]={};

scanf("%s", str);

res=strlen(str);

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

{

printf("'%c'\n", str[i]);

}

return 0;

}

*/


/*

#include<stdio.h>

#include<string.h>


int main()

{

int i, res=0;

char str[101]={};

gets(str);

res=strlen(str);

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

{

if(str[i]==' ')

{

continue;

}

printf("%c", str[i]);

}

return 0;

}

*/

/*

#include<stdio.h>

#include<string.h>

int main()

{

int x=0, y=0, z=0;

char str1[21]={}, str2[21]={}, str3[21]={};

scanf("%s %s %s", str1, str2, str3);

x=strlen(str1);

y=strlen(str2);

z=strlen(str3);

if(str1[x-1]==str2[0] && str2[y-1]==str3[0] && str3[z-1]==str1[0])

{

printf("good");

}

else

{

printf("bad");

}

return 0;

}

*/


/**

ASCII CODE : 모든 문자는 고유의 코드넘버가 있다.

American

Standard

Communication

Information

Interchange


'\0' 0 NULL


' ' 32


'0' 48

'1' 49

'2' 50

...

'9'

'10' (x)


'A' 65

'B' 66

...

'Z'



'a' 97

'b' 98

...

'z'

*/


/*

#include<stdio.h>

#include<string.h>

int main()

{

printf("%c\n",'a'-32);

printf("%d\n",'a');

printf("%c",97);

}

*/


/*

#include<stdio.h>

#include<string.h>


int main()

{

int i;

char str[1500]={};

gets(str);

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

{

if(str[i]!=' ')

{

if(str[i]>119)

{

str[i]=str[i]-23;

}

else

{

str[i]=str[i]+3;

}

}

}

printf("%s", str);

return 0;

}

*/


/*

#include<stdio.h>

#include<string.h>


int main()

{

int i;

char str[1001]={};

gets(str);

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

{

if(str[i]>64 && str[i]<91)

{

str[i]=str[i]+32;

}

else if(str[i]>96 && str[i]<123)

{

str[i]=str[i]-32;

}

}

printf("%s", str);

return 0;

}

*/


/*

#include<stdio.h>

#include<string.h>


int main()

{

int i;

char str[201]={};

gets(str);

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

{

if(str[i]!=' ')

{

if(str[i]<100)

{

str[i]=str[i]+23;

}

else

{

str[i]=str[i]-3;

}

}

}

printf("%s", str);

return 0;

}

*/


/*

#include<stdio.h>

#include<string.h>


int main()

{

int i, sum=0, res=0;

char str[501]={};

scanf("%s", str);

sum=strlen(str);

for(i=0; i<=sum-1; i++)

{

res += str[i]-48;

}

if(res%3==0)

{

printf("1");

}

else

{

printf("0");

}


return 0;

}

*/


/*

#include<stdio.h>

#include<string.h>


int main()

{

}

*/

3회 조회
주소 : 경기도 용인시 광교중앙로 302 블루 스퀘어 602호
연락처 : 031) 216 - 1546 ,     031) 215 - 1546
사업자등록번호 : 465-92-00916
​학원 등록 제 4603호
bottom of page