티스토리 툴바

ARM
RVCT2.2
(RealView Compilation Tools
)
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 브리야

Trackback Address :: http://moonoom.tistory.com/trackback/47 관련글 쓰기

댓글을 달아 주세요

Desire HD unboxing video

MOBILE 2010/10/13 13:32 |

11월 초에 출시하기로 돼어 있던 HTC사의 Desire HD 현재 해외에서는 출시가 밀어지는 나라들이 몇곳 있다고 하니 우리나라도 왠지 늦쳐지지 않을까 하는 생각을 해보면서...
 기다림에 지치신분들 이거 보면서 기운 내시길 후훗


크리에이티브 커먼즈 라이선스
Creative Commons License

'MOBILE' 카테고리의 다른 글

Desire HD unboxing video  (0) 2010/10/13
Posted by 브리야

Trackback Address :: http://moonoom.tistory.com/trackback/46 관련글 쓰기

댓글을 달아 주세요

열혈강의 미션 4_6번

C 2010/10/06 16:57 |

회사에서 다시 C하라고 해서 심심해서 짜봤는데 생각보다 쉽진 안네여.
예외처리를 좀 많이 해야 할거 같은데 시간은 없고 집에 가면 바로 오락만 하니...흠
많이 부족하지만 필요하신분은 잘 보시길..후훗
영어는 문법에 안맞을 확률이 후훗

#include "stdio.h"
#include "stdlib.h"
#include "string.h"

#define TRUE 1
#define FALSE 0


#define chkRangeNum (c_choice>48&&c_choice<=53)

void menuView();
//void resultView();
void f_insert();
void f_delete();
void f_search();
void f_printAll();
void f_exit();


typedef struct person{
 char name[10];
 char telephone[20];
}PERSON;

PERSON* pPerson[100];

int i_cntPerson;//총 입력한 사람 수를 세기 위한 변수
char c_choice;

void main()
{
 
 int b_flag_fin=TRUE;//루프 종료를 위한 flag


 while(b_flag_fin)
 {
 menuView();
 printf("Choose the item : ");
 scanf("%d",&c_choice);
// printf("%c",c_choice);
//  if (chkRangeNum)
//  {
//   if (chkRangeNum)
//   {
//    continue;
//   }
   switch (c_choice)
   {
   case 1:
    f_insert();
    break;
   case 2:
    f_delete();
    break;
   case 3:
    f_search();
    break;
   case 4:
    f_printAll();
    break;
   case 5:
    f_exit();
    b_flag_fin=FALSE;
    break;
   default:
    printf("Wrong number Please try again \n");  
   }
//  }
 
  puts("\n");
 }
}

void menuView()
{
 puts("=============MENU=============");
 puts(" 1. Insert");
 puts(" 2. Delete");
 puts(" 3. Search");
 puts(" 4. Print All");
 puts(" 5. Exit ");
 puts("==============================");
}

void f_insert()
{
 //int i=0;
 puts("[Insert]");
 puts("-=Register Information=-");
 
 pPerson[i_cntPerson]=(PERSON*)malloc(sizeof(PERSON));
 printf(" Index %d\n",i_cntPerson);
 do
 {
  printf(" Input Name : ");
  scanf("%s",pPerson[i_cntPerson]->name);
 } while (strlen(pPerson[i_cntPerson]->name)<=0||strlen(pPerson[i_cntPerson]->name)>20);//이름 길이가 20자 이상일 때 재입력

 do
 {
  printf(" Input Tel Number : ");
  scanf("%s",pPerson[i_cntPerson]->telephone);
 } while (strlen(pPerson[i_cntPerson]->telephone)<=0||strlen(pPerson[i_cntPerson]->telephone)>20);
 
 if(pPerson[i_cntPerson]->name!=NULL&&pPerson[i_cntPerson]->telephone!=NULL){
  puts(" ----->Data Inserted");
 }
 
 i_cntPerson++;

}//f_insert


void f_delete()
{
 int i;
 char ca_delName[20];
//ERSON *temp[10];
 if(i_cntPerson!=NULL)//데이터가 존재하면
 {
  printf("Input name : ");
  scanf("%s",ca_delName);
  for(i=0;i<i_cntPerson;i++)
  {
   if(strcmp(ca_delName,pPerson[i]->name)==0)
   {
    free(pPerson[i]);
    for(;i<i_cntPerson-1;i++)
    {
     pPerson[i]=pPerson[i+1];
    }//end for
    i_cntPerson--;
    puts("Deleted");
    break;
   }
  }
 }
 else
 {
  puts("No Data");
 }
}//f_delete

void f_search()
{
 int i;
 int i_compCnt=0;
 char ca_compName[20];

 if (i_cntPerson==0)
 {
  puts("\n------------RESULT------------");
  puts("Can't find any data Please insert data!! ");
 }
 else
 {
  printf("Input Searching Name : ");
  scanf("%s",ca_compName);
  puts("\n------------RESULT------------");

  for(i=0;i<i_cntPerson;i++)
  {
   if (strcmp(ca_compName,pPerson[i]->name)==0)//데이터 양 적으므로 strcmp로 비교 return값이 0이면 같은 문자
   {
    printf("Name :  %s \tTelephone : %s\n",pPerson[i]->name,pPerson[i]->telephone);
    i_compCnt++;
   }
  }//end for
  if (i_compCnt==0)
  {
   puts("Cant find the matched data!!");
  }
 }//end if
}//f_search

void f_printAll()
{
 int i;
 puts("\n[Print All Data]");
 puts("------------RESULT------------");
 if (i_cntPerson!=0)
 {
  for(i=0;i<i_cntPerson;i++)
  {
   printf("Name : %s \t Phone:%s \n",pPerson[i]->name,pPerson[i]->telephone);
  }
 }
 else
 {
  puts("No Data");
 }
}//f_printAll

void f_exit()
{
 int i;
 puts("Bye~~~");
 for(i=0;i<i_cntPerson;i++)
 {
  free(pPerson[i]);
 }
}//f_exit

크리에이티브 커먼즈 라이선스
Creative Commons License

'C' 카테고리의 다른 글

열혈강의 미션 4_6번  (0) 2010/10/06
연산자 우선순위  (0) 2010/10/04
Posted by 브리야

Trackback Address :: http://moonoom.tistory.com/trackback/45 관련글 쓰기

댓글을 달아 주세요