끼적거리다가 본격적으로 연습 시작.

최종 목표는 LDPC decoder 시뮬레이터 여러 방법으로 실행하기


https://www.codecademy.com/learn/python


1.

print "Welcome to Python!"


2. 변수, 숫자

# Write your code below!

my_variable = 10


3. 변수, 실수, 불리언

my_int = 7

my_float = 1.23

my_bool = True


4. 변수 재 어사인

my_int = 7

# Change the value of my_int to 3 on line 8!

my_int =3

print my_int


5. python 에서 공백은 code structure 에 영향을 줌, space 나 tab 으로 indentation 함으로써 코드 구성 가능

def spam():

 eggs = 12

 return eggs

        

print spam()


6. interpreter 이해

spam = True

eggs = False


7. python 에서의 comment 는 #

#this is comment for python

mysterious_variable = 42


8. multi-line comment 는 큰따옴표 세 개 사이에 넣기

"""multi line comment

comment

comment

"""


9. 산술연산 ; 덧셈

# Set count_to equal to the sum of two big numbers

a_big = 1000000

b_big = 20102301


count_to = a_big+b_big


print count_to


10. 지수승은 ** 

eggs = 10**2


print eggs


11. 모듈로 연산은 똑같음 %

spam =5%4

print spam


12. 종합

# all together

monty = True

python = 1.234

monty_python = python**2



13. meal 계산

# Assign the variable total on line 8!


meal = 44.50

tax = 0.0675

tip = 0.15


meal = meal + meal * tax


total = meal + meal*tip

print("%.2f" % total)

'Python' 카테고리의 다른 글

functions  (0) 2016.02.08
Pig Latin  (0) 2016.02.08
Conditional and control flow  (0) 2016.02.05
datetime library  (0) 2016.02.04
string  (0) 2016.02.02

#include <iostream>


int main(void){

std::cout << "Hello world!" << std::endl;

std::cout << 1 << 'a' << "String" << std::endl;

return 0;

}


strcat 같은 함수가 필요없구나.

예제코드 다 코딩하기 보다는 연습문제 풀면서 공부하자.


연습문제 


1-1-1


#include <iostream>


int main(void){

int in[10];

int sum = 0;

for (int i = 0; i < 10; i++)

{

std::cout << i + 1 << "번째 수 입력:";

std::cin >> in[i];

sum += in[i];

}

std::cout << "합계: " << sum << std::endl;


return 0;

}


1-1-2 

#include <iostream>


int main(void){

char name[50];

char phone[15];


std::cout << "Name: ";

std::cin >> name;


std::cout << "Phone#: ";

std::cin >> phone;


std::cout << "Name : " << name << std::endl << "Phone Number: " << phone << std::endl;


return 0;

}

String 따로 배우면 또 달라지겠지


1-1-3

#include <iostream>


int main(void){

int input;


std::cout << "Number: ";

std::cin >> input;

for (int i = 1; i < 10; i ++)

std::cout << input << " X " << i << " = " << input*i << std::endl;


return 0;

}







'C and C++' 카테고리의 다른 글

OpenMP in Macbook  (0) 2016.03.10
OpenMP  (0) 2016.03.09
C언어 최적화 기법  (0) 2016.02.05
Fixed point with C++  (0) 2015.12.08
C++ , 객체지향  (0) 2015.12.08

LDPC Decoder를 C++로 뜯어고치기 프로젝트를 들어가기로 했다.


괜히 fixed point가 가능한 라이브러리들을 찾아보았는데 링크를 그냥 날려버리기 뭣해서 블로그에 정리해둔다.


http://stackoverflow.com/questions/2945747/c-fixed-point-library

이 글에 다양한 링크들이 있는데 몇가지 추리자면,


http://www.codeproject.com/Articles/37636/Fixed-Point-Class


https://alikhuram.wordpress.com/2013/05/20/implementing-fixed-point-numbers-in-c/

'C and C++' 카테고리의 다른 글

OpenMP in Macbook  (0) 2016.03.10
OpenMP  (0) 2016.03.09
C언어 최적화 기법  (0) 2016.02.05
걸음마  (0) 2015.12.08
C++ , 객체지향  (0) 2015.12.08

+ Recent posts