출범한 이유 : 안드로이드 따로 ios 따로 개발하는 것 귀찮아서...

 

  특징 단점 언어
아이오닉 -웹뷰를 쓰기 때문에 웹을 개발하던 언어로 하이브리드 앱을 만들 수 있게 되었다. -네이티브한 기능이 업데이트되지 않아서 사용 못할 가능성 높다.  
리액트 -리엑트 - 웹
리엑트 네이티브 - 앱
둘 사이에 일부코드는 공유 가능
-RestAPI를 사용하지 않고 GraphQL 사용하면 최강인 Apollo GraphQL 패키지 사용가능
-학생이 하기에 UI적인 측면에서 신경써야할 부분이 쉽지 않음.
-FireBase 같은 백엔드와 연동하는 정식 라이브러리가 제공X
-실제로 개발에 돌입하면 단점이 너무 많음.
-버그가 많음.

Javascript
플러터(구글) -Flutter UI 컴포넌트를 플랫폼안에 내장하여서 쉽게 사용가능.
- 직접화면에 컴포넌트를 그려버림.
- 리액트에서 단점들이 원래 너무 기본적인 것그래서 장점으로 느껴짐
-다트(Dart) 라는 언어를 쓴다는 점 최악.
-결국 개발자 성장X
-아직까진 쓰기엔 좀 업데이트가 버젼이 낮아서 쓰기엔 좀 그렇다.
Dart

결론 : React에 익숙한 개발자들이 많거나 빠른 성장을 위해 개발자 수급이 빨라야한다면, React Native 사용

좋은 개발 프로세스를 즐기며 프레임워크와 함께 성장할 자신이 있다면 Flutter를 사용 

취업을 위해선 React를 쓰는게 유리해보임.

'App Project' 카테고리의 다른 글

Project_Plan  (0) 2020.06.29
AWS  (0) 2020.06.26

Step1) Class VIew 

Step2) ~~.dlg 클릭

Step3) 해당 모양 클릭

Step4) PreTranslateMessage 함수생성

Step5) 함수 입력 

BOOL CDbfReaderDlg::PreTranslateMessage(MSG* pMsg)
{
	// TODO: Add your specialized code here and/or call the base class
	if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
	{
		OnBnClickedBtnRun();
		return TRUE; 
	}
	return CDialogEx::PreTranslateMessage(pMsg);
}

ShellExecute 함수

1)txt 파일 열기

2)경로 열기

//txt 파일 열기
void CDbfReaderDlg::OnBnClickedBtnOpendata()
{
	if (openoutputDataPath == "")
	{
		MessageBox(_T("RUN 해주세요."));
		return;
	}
	//openoutputDataPath.Replace(L"\\", L"\\\\");
	// TODO: Add your control notification handler code here
	ShellExecute(NULL, _T("open"), _T("notepad"), openoutputDataPath, NULL, SW_SHOW);
	 

}


//폴더 열기 
void CDbfReaderDlg::OnBnClickedBtnOutpathopen()
{
	if (openoutputPath == "")
	{
		MessageBox(_T("RUN 해주세요."));
		return;
	}
	// TODO: Add your control notification handler code here
	
	
	// TODO: Add your control notification handler code here
	//ShellExecute(NULL, _T("open"), _T("notepad"), openinputPath, NULL, SW_SHOW);
	ShellExecute(NULL, _T("open"),  openoutputPath,NULL, NULL, SW_SHOW);
}

 

 

CFileFind란 Class를 사용하면 된다.

//해당경로에 폴더있는지 확인하는 것
CFileFind  cFileFinder;
bool temp=  cFileFinder.FindFile(_T("C:\\Users\\SW\\Desktop"));

 

 

 

 

ini등 실행파일의 위치 기반으로 전처리 작업을 해야할 때 사용할 수 있는 현재 실행파일의 위치(경로) 반환 소스이다.

	TCHAR path[260];
	GetModuleFileName(NULL, path, sizeof path); //path에 실행파일의 위치+.exe 까지 담는다.
	CString strPath = path;
	//파싱작업
	int i = strPath.ReverseFind('\\'); //실행 파일 이름을 지우기 위해 
	strPath = strPath.Left(i); //뒤에있는 현재 실행 파일 이름을 지운다.
	AfxMessageBox(strPath);

 

 

다이얼로그는 크게 파일/폴더 탐색 두가지로 구분 되며 다음은 파일경로를 탐색하여 그 위치의 저장하는 코드이다. 

 

1) Edit Control 생성

2) 파일 경로 설정

 

3) 결과

 

4)코드

 

void CTEST_CREATEDlg::OnBnClickedButton1()
{
	//char szFilter[20]  ;
	CString szFilter = _T("txt file(*.txt)|*.txt; |ALL File(*.*(|*.*||");
	CFileDialog dlg(FALSE, _T(""), NULL, OFN_OVERWRITEPROMPT, szFilter);
	//CFileDialog dlg(FALSE, "bmp", "pcmon", OFN_OVERWRITEPROMPT, szFilter);
	// TODO: Add your control notification handler code here
	CString strFolder;
	CString strPath;
	CString strFileName;
	CString strFolderPath;
	if (IDOK == dlg.DoModal())
	{
		strFolder = dlg.GetFolderPath();
		strPath = dlg.GetPathName();
		strFileName = dlg.GetFileName();

		m_strFFolder.SetWindowTextW(strFolder);
		m_strFPath.SetWindowTextW(strPath);
		m_strFName.SetWindowTextW(strFileName); 
		
	} 
}

 

기존의 char 배열에 szFilter를 CString으로 구현 --> MFC에 더 효율적 (유니코드, 멀티바이트 등의 형식오류 최소화)

 

 

5) 추가 

1) 경로에서 파일이름을 제외하고 경로만 추출

2) 경로에서 파일이름만 추출하고 싶을때  또는 마지막 경로depth를 추출

CString re = strPath.Mid(0, strPath.ReverseFind('\\'));//파일경로 (마지막경로제외)
CString res = strPath.Mid(strPath.ReverseFind('\\')+1, strPath.GetLength());//마지막경로

 

전형적인 시간은 오래잡아먹고 맞춰도 테케만 맞춘거같은 느낌의 문제...

무조건 또 풀어봐야한다.  

난이도 Lv1 라고 하지만 Lv2 이상인 것 같다.

문제

입출력

문제해석

 

다음과 같은 숫자 다이얼에서 각각 왼손/오른손 엄지로 누르는 최적의 위치 탐색(BFS)

 

 

실패코드 

우선 풀면서도 너무 헷갈리게 품... 흐름을 놓치면 첨부터 보느라 시간너무 잡아먹음

너무 알고리즘 보단 하드코딩 느낌으로 품 (시간소모 심하고, 효율성 떨어짐)

간과한점

  • 해당문제는 번호판의 배열이 총 12개로 한정적이기때문에 번호판의 좌표를 배열에 넣어야한다.
  • 또한 바둑판 최단거리등이 나올때 dfs/bfs으로 접근하려는 선입견X
  • (x,y) -> (a,b) 지점 사이의 거리의 로직을 생각
#include <string>
#include <queue>
#include <iostream>
using namespace std;

int cal[] = { -3, +1, +3, -1 };//위, 오, 아, 왼
int locLeft = 10;
int locRight= 12;
 
string solution(vector<int> numbers, string hand) 
{

	string answer = "";

	for (int i = 0; i < numbers.size(); i++)
	{
		if (numbers[i] == 0)
			numbers[i] = 11;
		if (numbers[i] == 1 || numbers[i] == 4 || numbers[i] == 7)
		{
			locLeft = numbers[i];
			answer += "L"; 
		}
		else if (numbers[i] == 3 || numbers[i] == 6 || numbers[i] == 9)
		{
			locRight = numbers[i];
			answer += "R";
		}
		//numbers[i] == 0 이면 11이다.
		else
		{
			int cntL = 1;
			int cntR = 1;
			int comL;
			int comR;
			bool visit[12] = { false, };
			bool visit2[12] = { false, };
			queue<int> q;
			queue<int> q2;

			q.push(locRight);
			q2.push(locLeft);

		
			while (!q.empty())
			{
				int ex =0;
				int x = q.front();
				visit[x] = true;
				q.pop();
				for (int w = 0; w < 4; w++)
                {
					int dx = x + cal[w];
					if (visit[dx] == true)
						continue;

					//예외처리 1) 1,4,7,11 왼쪽불가 2)1,2,3 위로불가 , (3) 3,6,9,12 오불가 , (4) 10,11,12아래로 불가 
					if (w == 1 && (dx == 4 || dx == 7 || dx == 10 || dx == 13))
						continue;
					if (w == 0 && (dx == 0 || dx == 1))//위로
						continue;
					//아래
					if (w == 2 && dx == 14 || dx == 15)
						continue;
					
					if (dx == 1 || dx == 4 || dx + cal[w] == 7)
						continue; 

					q.push(dx);
					visit[dx] = true;

					if (dx == numbers[i])
					{
						ex = 1;
						comR = cntR+1;
						break;
					}
				
				}
				if (ex == 1)
				{
					break;
				}
				cntR++;

			}
			while (!q2.empty())
			{
				int ex=0;
				int x = q2.front();
				visit2[x] = true;
				q2.pop();
				for (int w = 0; w < 4; w++)
				{
					int dx = x + cal[w];
					if (visit2[dx] == true)
						continue;
					//예외처리 1) 1,4,7,11 왼쪽불가 2)1,2,3 위로불가 , (3) 3,6,9,12 오불가 , (4) 10,11,12아래로 불가 
					if (w == 3 && (dx == 0 || dx == 3 || dx == 6 || dx == 9))
						continue;
					if (w == 0 && (dx == -2 || dx == -1))//위로
						continue;
					if (w == 2 && dx == 13 || dx == 14)
						continue;
					if (dx == 3 || dx == 6 || dx == 9)
						continue;
					
					q2.push(dx);
					visit2[dx] = true;
					if (dx== numbers[i])
					{
						comL = cntL+1;
						ex = 1;
						break;
					}

				}

				if (ex == 1)
				{
					break;
				}
				cntL++;
			}

			if (comL < comR)
			{
				answer += "L";
				locLeft = numbers[i];

			}
			else if (comL > comR)
			{
				answer += "R";
				locRight = numbers[i];
			}
			else
			{
				if (hand == "right")
				{
					answer += "R";
					locRight = numbers[i];
				}
				else
				{
					answer += "L";
					locLeft = numbers[i];
				}
			}
		}
	}


	return answer;
 

}

 

Sol 코드

우선 현지점 목표지점까지 거리는 (x,y) -> (a,b)  절대값(x-a) + (y-n) 이다.

우선 각 번호의 좌표배열을 만들고 목표지점과의 거리를 구하는 로직을 구현함.

#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int locLeft = 10;
int locRight = 11;
pair<int, int> ar[12] = { { 3, 1 }, { 0, 0 }, { 0, 1 }, { 0, 2 }, { 1, 0 }, { 1, 1 }, { 1, 2 }, { 2, 0 }, { 2, 1 }, { 2, 2 }, { 3, 0 }, { 3, 2 } };

string solution(vector<int> numbers, string hand)
{
	//solution({ 7, 0, 8, 2, 8, 3, 1, 5, 7, 6, 2 }, "left");
	string answer = "";

	for (int i = 0; i < numbers.size(); i++)
	{
		if (numbers[i] == 1 || numbers[i] == 4 || numbers[i] == 7)
		{
			locLeft = numbers[i];
			answer += "L";
		}
		else if (numbers[i] == 3 || numbers[i] == 6 || numbers[i] == 9)
		{
			locRight = numbers[i];
			answer += "R";
		}
		//numbers[i] == 0 이면 11이다.
		else
		{
			int leftmax = abs(ar[numbers[i]].first - ar[locLeft].first) + abs(ar[numbers[i]].second - ar[locLeft].second);
			int rightmax = abs(ar[numbers[i]].first - ar[locRight].first) + abs(ar[numbers[i]].second - ar[locRight].second);
			if (leftmax > rightmax)
			{
				locRight = numbers[i];
				answer += "R";
			}
			else if (leftmax < rightmax)
			{
				locLeft = numbers[i];
				answer += "L";
			}
			else if (leftmax == rightmax)
			{
				if (hand == "right")
				{
					locRight = numbers[i];
					answer += "R";
				}
				else
				{
					locLeft = numbers[i];
					answer += "L";
				}
			}
		}
	}

	return answer;
}

int main()
{

	//solution({ 1, 3, 4, 5, 8, 2, 1, 4, 5, 9, 5 }, "right");
	solution({ 7, 0, 8, 2, 8, 3, 1, 5, 7, 6, 2 }, "left");
	return 0;
}

 

https://programmers.co.kr/learn/courses/30/lessons/64061

문제

 


입력&출력


문제해석

2차원 배열이 주어짐.  

다음과 같이 적재됨. moves의 순서대로 인형을 뽑음. 배열로 따지면 moves[n]-1

1) 인형을 뽑으면 해당칸은 0 처리해준다.

2) 바구니는 후입선출 이므로 vector로 처리해준다. 같은 인형을 만났을때 vector.pop_back 해주며

3) 최종값에서 x2 해준다. 

난이도


실수

X
스스코드

#include <string>
#include <vector>
#include <iostream>
using namespace std;

int solution(vector<vector<int>> board, vector<int> moves) 
{
	int answer = 0;
	vector<int> buket;
	for (int i = 0; i < moves.size(); i++)
	{
		int tempInt;
		tempInt = moves[i]-1;

		for (int j = 0; j < board[tempInt].size(); j++)
		{
			if (board[j][tempInt] != 0)
			{
				//if (buket.back() == board[j][tempInt] && buket.size() >= 1)
				if (buket.size()>=1)
				{
					if (buket.back() == board[j][tempInt])
					{
						buket.pop_back();
						answer++;
						board[j][tempInt] = 0;
						break;
					}
				} 
			 
				buket.push_back(board[j][tempInt]); 
				board[j][tempInt] = 0;
				break;
			}
			else
			{

			}
		}
	}
	answer = answer * 2;
	return answer;
}


int main()
{
	
	solution({ { 0, 0, 0, 0, 0 }, {0, 0, 1, 0, 3 }, {0, 2, 5, 0, 1}, {4, 2, 4, 4, 2}, {3, 5, 1, 3, 1}}, { 1, 5, 3, 5, 1, 2, 1, 4 });
	return 0;
}

+ Recent posts