티스토리 뷰
8.1 Arrays Hold Multiple Values
int tests[ISIZE];
8.2 Accessing Array Elements
tests[0] = 79;
cout << tests[0];
cin >> tests[1];
tests[4] = tests[0] + tests[1];
cout << tests;
8.3 Inputting and Displaying Array Contents
const int ISIZE = 5;
int tests[ISIZE]; // Define 5-elt. array
cout << "Enter first test score ";
cin >> tests[0];
8.4 Array Initialization
const int ISIZE = 5;
int tests[ISIZE] = {79,82,91,77,84};
8.5 Processing Array Contents
if (principalAmt[3] >= 10000)
interest = principalAmt[3] * intRate1;
else
interest = principalAmt[3] * intRate2;
tests[i]++; // adds 1 to tests[i]
tests[i++]; // increments i, but has
// no effect on tests
8.6 Using Parallel Arrays
const int ISIZE = 5;
string name[ISIZE]; // student name
float average[ISIZE]; // course average
char grade[ISIZE]; // course grade
8.7 The typedef Statement
typedef unsigned int Uint;
Uint tests[ISIZE];
8.8 Arrays as Function Arguments
// Function prototype
void showScores(int []);
// Function header
void showScores(int tests[])
// Function call
showScores(tests);
8.9 Two-Dimensional Arrays
int exams[4][3];
8.10 Arrays with Three or More Dimensions
void getRectSolid(short [][3][5]);
8.11 Vectors
scores.push_back(75);
howbig = scores.size();
scores.pop_back();
scores.clear();
while (!scores.empty())
8.12 Arrays of Class Objects
class Square
{ private:
int side;
public:
Square(int s = 1)
{ side = s; }
int getSide()
{ return side; }
};
Square shapes[10];
'Programming Language > C++' 카테고리의 다른 글
[C++] pipe 통신 (0) | 2014.08.15 |
---|---|
[계절학기 C++] Class (0) | 2014.07.09 |
[강좌#3] Expressions and Interactivity (0) | 2014.06.30 |
[강좌2] 3일차 (0) | 2014.06.27 |
vector... (0) | 2013.07.10 |
- Total
- Today
- Yesterday
- python
- problem
- 오픽
- 캠핑
- 24년
- 오미크론
- 컴인워시
- Algorithm Schedule
- 수원
- 데이터사이언스
- 쿠팡
- 디아블로4
- 코인
- 레스토랑
- 호텔
- 겨울러그
- 맛집
- NFT
- 삼성전자
- 에러
- Algorithm
- 원소술사
- 가성비
- 다이나믹 프로그래밍
- 단열벽지
- 해결방법
- 엔진오일
- 3만원대
- 겨울
- 여름
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |