Yurttas/PL/OOL/Cplusplus/F/07/03/02/00/mmap 01.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2005
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9
10   date   : September 1, 2005.
11   author : Salih Yurttas.
12
13   mmap_01.cpp
14*/
15
16#include <iostream>
17
18#include <vector>
19#include <string>
20
21#include <map>
22
23using namespace std;
24
25int main(int argc, char* argv[]) {
26
27  string dna_list[] = {"AGGCTAAT",
28                       "GGCTAATA",
29                       "TGTAAATT",
30                       "ACGAGGCT"};
31  int n = 4;
32
33  int counts_list[] = {2,
34                       2,
35                       4,
36                       1};
37
38  int positions_list[][4] = {5, 8, 0, 0,
39                             4, 7, 0, 0,
40                             1, 3, 7, 8,
41                             8, 0, 0, 0};
42
43  for(int i=0; i<n; ++i) {
44    cout << dna_list[i] << " - ";
45    int m = counts_list[i];
46    cout << m << " ";
47    for(int j=0; j<m-1; ++j)
48      cout << positions_list[i][j] << ",";
49    cout << positions_list[i][m-1] << endl;
50  }
51
52}