티스토리 뷰
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
const double zero = 0.0;
/*
void print2arr(char** mat, int n)
{
for(int i=0; i<n;i++)
{
for(int j=0; j<n;j++)
{
cout<<setw(3)<<mat[i][j];
}
cout<<endl;
}
}
void initArr(char** mat, int n)
{
for(int i=0; i<n;i++)
{
for(int j=0; j<n;j++)
{
mat[i][j] = zero;
}
}
}
int main()
{
int n = 10;
char** a;
a = new char*[n];
for(int i=0;i<n;i++)
{
a[i] = new char[n];
}
initArr(a,n);
for(int i=0; i<n; i++)
{
for(int j=0;j<n;j++)
{
if(i<=j)
{
a[i][j] = '*';
}
}
}
print2arr(a, n);
return 0;
}
*/
void print1Dmat(vector <double>&mat, int n)
{
for(int i=0;i<n;i++)
{
cout<<setw(5)<<mat[i];
}
}
void print2Dmat(vector<vector<char>>&mat, int n)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<setw(4)<<mat[i][j];
}
cout<<endl;
}
}
int main()
{
int n = 10;
vector <double>a(n);
for(int i=0;i<n;i++)
{
a[i] = i;
}
// print1Dmat(a, n);
vector<vector<char>> b(n, vector<char>(n));
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(i<=j)
{
b[i][j] = '*';
}
}
}
print2Dmat(b, n);
return 0;
}
'Language > C' 카테고리의 다른 글
| vector class/template이용한 2차원 배열 생성 (0) | 2009.02.04 |
|---|---|
| C++ Random Numbers (0) | 2009.01.07 |
| 이차원 동적 배열 설정 (0) | 2009.01.04 |
| VS2005 에서 VS2008 로 넘어갈때의 팁 (0) | 2008.09.01 |
| Financial Numerical Recipes in C ++. (1) | 2008.08.12 |
- Total
- Today
- Yesterday
- RfR
- market convention
- recession
- mathematical finance
- 꿀떡이
- LG
- JPY
- finance
- VBA
- 가을
- 유동성최악
- Fallback rate
- financial
- Linear Gaussian Model
- 회고2023
- 금융공학
- 크레딧투자
- random gereragtor
- 리보중단
- 와인
- XAG
- Risk Free Rate
- 세식구
- 포트폴리오
- Volatility Ratio
- computational finance
- 금융수학
- SOFR
- CHF
- 어렵다크레딧
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |