일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- html object
- #2차원배열
- html multimedia
- #3차원배열
- html charset
- html video
- #1차원배열
- border-box
- #성적관리프로그램
- git flow
- html id
- html youtube
- html5 new tag
- html plug-in
- hyperledger transaction
- mac terminal command
- relative path
- #자바상속#자바이즈어#is~a
- #다차원포인터
- 하이퍼레저패브릭
- #bubbleSort
- #C++ 연산자함수오버로딩
- #JAVASCRIPT
- html code
- #CallByAddress
- #C++ has~a
- docker example
- 토큰경제
- #binary
- #android activity
- Today
- Total
A sentimental robot
문자열 비교함수 본문
#include<stdio.h>
#include<string.h>
#pragma warning(disable:4996);
void main(){
char name[3][10];
int i, j,r =0;
int score[3][4] = { 0, };
float avg[3];
char sName[10];
for (i = 0; i < 3; i++)
{
printf("name input :");
scanf("%s", name[i]);
for (j = 0; j < 3; j++) {
printf("score input : ");
scanf("%d", &score[i][j]);
score[i][3] += score[i][j];
avg[i] = score[i][3] / 3.f;
}
}
for (i = 0; i < 3; i++) {
printf("%s\t", name[i]);
for (j = 0; j < 4; j++)
{
printf("%d\t", score[i][j]);
}
printf("%f\n", avg[i]);
}
// search
printf("Name for search:");
scanf("%s",sName);
for(i=0 ; i<3 ; i++){
r=strcmp(name[i],sname);
if(r == 0){
printf("%s\t%d\t%d\t%d\t%d\t%f\n",sName,score[i][0],score[i][1],score[i][2],score[i][3],avg[i]);
break;
}
if(i == 2) printf("check the name again");
}
}