일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- #3차원배열
- mac terminal command
- html code
- html charset
- html plug-in
- #C++ 연산자함수오버로딩
- #1차원배열
- #C++ has~a
- html5 new tag
- #CallByAddress
- html video
- #binary
- border-box
- relative path
- html youtube
- 하이퍼레저패브릭
- 토큰경제
- #JAVASCRIPT
- html id
- #자바상속#자바이즈어#is~a
- html object
- #2차원배열
- hyperledger transaction
- html multimedia
- #bubbleSort
- #다차원포인터
- #android activity
- docker example
- git flow
- #성적관리프로그램
- 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");
}
}