본문 바로가기

SW Study

(30)
C# 파일 이름 중복일 때 (N)으로 파일명 생성 #region FileUploadName : 파일업로드시 파일명 생성하기 - 동일 파일이 이미 존재할 경우 파일명(+count)로 생성 public string FileUploadName(String dirPath, String fileN) { string fileName = fileN; if (fileN.Length > 0) { int indexOfDot = fileName.LastIndexOf("."); string strName = fileName.Substring(0, indexOfDot); string strExt = fileName.Substring(indexOfDot); bool bExist = true; int fileCount = 0; string dirMapPath = string.Em..
Visual Studio C# 라이브러리 추가 도구 -> NuGet 패키지 관리자 -> 솔루션용 NuGet 패키지 관리 클릭 패키지 관리에서 원하는 라이브러리 검색, 설치
Vector 이용 #include #include #include using namespace std; class list { struct Num { char name[20]; char phone[20]; }; vector Nums; public: void Registerd() { char InName[20]; cin >> InName; Num *NewNum = new Num; strcpy(NewNum->name, InName); Nums.push_back(NewNum); } void listOut() { for (int i = 0; i
Linked List //Linked List 구조 #include using namespace std; struct Node //노드 구조 { int val; Node * next; }; class Iterator //순회자 클래스 { public: Node * CurrentNode; void Next() //다음으로 이동 { CurrentNode = CurrentNode->next; } int PointVal() //가리키는 값 { return CurrentNode->val; } bool Compare(Iterator diffIter) //노드 비교 { // return CurrentNode != diffIt.CurrentNode; if (CurrentNode != diffIter.CurrentNode) return tr..
도전! 프로그래밍4 도전7 #include #include #include typedef struct personinfo { char name[20]; char phoneNum[20]; } PersonInfo; void Insert(PersonInfo *man, int * pnum) { printf("[ INSERT ] \n"); printf("Input Name: "); scanf("%s", man[*pnum].name); printf("Input Tel Number: "); scanf("%s", man[*pnum].phoneNum); printf(" Data Inserted \n\n"); (*pnum)++; } void Delete(PersonInfo *man, int * pnum) { char del[20] = { 0 }; ..
도전! 프로그래밍4 도전6 #include #include #include int num; typedef struct personinfo { char name[20]; char phoneNum[20]; } PersonInfo; void Insert(PersonInfo *man) { printf("[ INSERT ] \n"); printf("Input Name: "); scanf("%s", man[num].name); printf("Input Tel Number: "); scanf("%s", man[num].phoneNum); printf(" Data Inserted \n\n"); num++; } void Delete(PersonInfo *man) { char del[20] = { 0 }; int i, j; if (num == 0)..
도전! 프로그래밍4 도전5 #include #include int main(void) { char ch1, ch2; FILE * fp1 = fopen("d1.txt", "rt"); FILE * fp2 = fopen("d2.txt", "rt"); if (fp1 == NULL||fp2 == NULL) { puts("file open error! "); return -1; } while (1) { ch1 = fgetc(fp1); ch2 = fgetc(fp2); if (ch1 != ch2) { printf("Not Coincide \n"); break; } else if (ch1 == EOF&&ch2 == EOF) { printf("Coincide \n"); break; } } fclose(fp1); fclose(fp2); return ..
도전! 프로그래밍4 도전4 #include int main(void) { char word[50]; int numA = 0, numP = 0; FILE * fp = fopen("text.txt", "rt"); if (fp == NULL) { puts("file open error! "); return -1; } while (1) { fscanf(fp, "%s", word); if (feof(fp) != 0) break; else if (word[0] == 'A' || word[0] == 'a') numA++; else if (word[0] == 'P' || word[0] == 'p') numP++; } printf("A start word's num: %d \n", numA); printf("P start word's num: %..