본문 바로가기

전체 글326

Android studio : View - RelativeLayout TextView android:id="@+id/gijun"                                  기준뷰 정하고 android:layout_width="100dp" android:layout_height="100dp" android:layout_centerInParent="true" android:background="@color/colorPrimaryDark" />TextView android:layout_toRightOf="@+id/gijun"                //toLeftOf , 오른쪽끝에 맞춰 android:layout_width="100dp" android:layout_height="100dp" android:background="@color/colorAccent.. 2020. 1. 7.
Android studio : View - LinearLayout .xml android:layout_width="match_parent" 폰 전체 크기 weigh : 가중치 1 : 2 .. gravity : center, bottom ... orientataion : verical, horizontal 2020. 1. 6.
안드로이드 스튜디오 , JDK 설치 https://itgroovy.tistory.com/427 2020. 1. 6.
Android studio (안드로이드 앱 개발) 메시지 출력하기 Toast.makeText(getApplicationContext(),txt,Toast.LENGTH_SHORT).show(); 함수 설정 후 함수이름을 onClick 속성으로 넣기 public void sayHello(View v) { String msg = "만나서 반갑습니다."; Toast.makeText(getApplicationContext(),msg+ msg.length(),Toast.LENGTH_SHORT).show(); //메시지 출력 } //msg.length() 로 메시지 추가 protected void function (View v) { int a,b,c; a= 3; b = 2; c = a+b; ToastMessage(c); } public void ToastMessage(String txt) { Toast.makeText(getApplicationContext(),txt,Toast.LENGTH_SHORT).s.. 2019. 9. 1.
Android studio : 이미지 위치 조정 이미지를 원하는 위치에 무작정 놓으면 적용이 안됨 하나하나 기준에 맞춰 당겨줘야함 코드로 위치 선정 가능하다. 2019. 9. 1.
JAVA windowbuilder / Unknown GUI toolkit error: unable to initialize main class catch1 caused by: java.lang.noclassdeffounderror: [lstring; 해결 지식인 https://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040201&docId=333856917 2019. 8. 31.
C++ 오류 : 여러 번 정의된 기호가 있습니다. 상속생성.obj에 이미 정의되어 있습니다. 오류 : 여러 번 정의된 기호가 있습니다. xxx.obj에 이미 정의되어 있습니다. LNK1169 LNK2005 자바를 해보니 프로젝트가 패키지 의미 인줄 알았다. C++에서는 한 프로젝트안에 파일 분할의 개념으로 헤더파일, cpp파일 등으로 나눌 수 있다. 그렇지만 한 프로제트 내에 main 문을 2개 이상 두면 위와 같은 오류 발생 int main(), void main() 2019. 1. 25.
C++ 다형성 가상함수 이해 간단 코드 다형성 virtual 가상함수 #include#includeusing namespace std; class A {public:virtual void f() { cout 2019. 1. 23.
C++ 상속inheritance, (순수)가상함수(pure)virtual function, 추상 클래스(abstract class), overriding, 바인딩 가상 함수 정의 virtual 기본 클래스 멤버 함수의 선언;virtual int computeSalary() { return 1500000; } 가상 함수 구현 Code 예시 #include #include using namespace std; //추상 클래스class Employee{private:string name;int id; public:Employee();Employee(string name, int id);~Employee();void setName(string name);string getName();void setId(int id);int getId(); virtual int computeSalary() { return 1500000; } //가상 함수, 보다 직관적으로 함수를 호출};.. 2019. 1. 18.
C++ 상속inheritance, derived class, 오버라이드(overriding) - Power C++ p565 LAB 상속inheritancederived class 선언class 파생 클래스 명 : 접근 지정자 기본 클래스 명{파생 클래스에 추가할 멤버 선언}; 클래스의 큰 장점인 '상속(inheritance)' '캡슐화(Encapsulation)' '다형성' protected : 파생클래스의 함수에서 기본 클래스의 protected멤버에 접근할 수 있다. 상속방법:class Student : public Human 기본 클래스의 public 멤버 -> 파생 클래스의 public 멤버기본 클래스의 protected멤버 -> 파생 클래스의 protected멤버기본 클래스의 private멤버 -> 파생 클래스의 private멤버 멤버 함수 오버라이드오버라이드(overriding) : 파생 클래스의 함수가 기본 클래스의 함.. 2019. 1. 17.
C++ operator+ 연산자 오버로드(operator overloading) ,friend ostream& operator / friend istream& operator (스트림) 1. operator overloading 객체간의 연산을 위한 기능연산자 오버로드(operator overloading) 이라고 한다. 경우 1) 인수가 한 개리턴 값의 형 operator 연산자(인수);Complex operator+(Complex c); //이항 연산자를 멤버 함수로 오버로드 연산결과 +연산자의 왼쪽변수 오른쪽 변수Complex Complex::operator+(Complex c); //코드{Complex com(0,0);com.real = real + c.real;com.imag = imag + c.imag;return com;} 경우 2) 인수가 두 개friend 리턴 값의 형 operator 연산자 (인수1, 인수2);friend Complex operator+ (int c1,.. 2019. 1. 16.
C++ 기초 static변수 최다 최소 구하기 / 여러 번 정의된 기호가 있습니다.LNK1169 LNK2005 Student.h #pragma once#include #include using namespace std; class Student { string name; int kor, math, eng, avr; public:static int count;Student();double getAvr();string getName();static int getcount() { return count; }~Student() {}}; Student.cpp #include "Student.h"#include using namespace std; Student ::Student(){cout > name;cout > kor;cout > math;cout > eng;++count;//생성시 증가} double Student .. 2019. 1. 16.