青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

DraculaW

  C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
  19 隨筆 :: 0 文章 :: 7 評論 :: 0 Trackbacks
Assessing Infection

Background

According to the World Health Organization, infectious disease ranks as the leading cause of death in the world. In 1998 alone, over 17 million people died from infectious and parasitic diseases such as acute lower respiratory infections, tuberculosis, HIV/AIDS, and malaria. It is forecast that infectious disease will continue to kill millions of people, especially those living in developing countries.

The medical profession and scientific community of the world are fighting the infectious disease threat with new tools and technologies from a variety of fields. From this effort, a new field of research has emerged. Infectious Disease Epidemiology is the study of the variables that influence the growth and spread of infectious diseases. This relatively new field combines molecular biology, immunology, genetics, and the computational sciences. A focus of this field is the study of the factors that influence the growth of an infectious disease within a single organism, and the factors that influence the pattern of infection across an entire population.

Description

This assignment asks you to finish the implementation of a program that assesses the level of infection in a tissue sample. You are given data representing a rectangular tissue sample, overlaid with a grid. Certain portions of the tissue are infected; others are not. Your goal is to help assess the extent of the infection by writing a program that, given the coordinates of a colony of infection, can determine its size.

A typical use of the program follows. The user interacts with the program only through command-line arguments. The user supplies to the program a data filename and the coordinates of a cell in the grid. The coordinates are specified by row and then column, both starting at zero. The program calculates the extent of infection at that coordinate and outputs a two-dimensional representation of the tissue sample. Figure 1 depicts the execution of the program.

A screen shot from a sample solution
Figure 1 Output from a sample solution

For the purpose of this assessment, we consider a "colony" of infected tissue to be a set of adjacent and infected cells. In Figure 1, we can see three separate colonies. The smallest colony consists of two cells and is located in the lower left corner of the grid. Another colony consisting of three infected cells exists on the far right edge of the grid. The largest colony of eight cells resides primarily in the middle of the grid. This colony has a small arm into the upper left corner of the grid. Notice from this colony that cells residing in diagonals are considered "adjacent." The plus signs next to the cells in this largest colony indicate that they all belong to the colony that contains the user entered coordinate.


solution :

#ifndef GRID_H
#define GRID_H

#include <string>
#include <vector>

using namespace std;

/*
* IMPORTANT NOTE:
*
* For this assignment, you might need to add state to the
* class and/or augment existing methods, and/or create private helper
* methods, but you should not delare new public methods
*/

const bool INFECTED = true;
const bool NOT_INFECTED = false;

class grid;

class grid {

private:
    int rows;
    int cols;
    vector<bool> *area;
    vector<bool> *infect;
    int indexof (int row, int col) const;
    bool infected(int row, int col) const;

public:
    grid (string file);
    ~grid ();

    int count (int row, int col);

    friend ostream &operator<<(ostream &stream, const grid& ob);

};

#endif

============================================================================

#include <iostream>
#include <fstream>

using namespace std;

#include "grid.h"

// You do not need to alter function indexof.
int grid::indexof (int row, int col) const {
    return row*cols+col;
}

// You do not need to alter function infected.
bool grid::infected(int row, int col) const {
    return (area->operator[](indexof(row, col)) == INFECTED);
}

// You may need to alter the constructor
grid::grid (string file) {

    ifstream grid_file;

    grid_file.open (file.c_str());

    grid_file >> rows;
    grid_file >> cols;

    area = new vector<bool>(rows*cols, NOT_INFECTED);
    infect = new vector<bool>(rows*cols, NOT_INFECTED);
   
    while (true) {

        int blob_row;
        int blob_col;

        grid_file >> blob_row;
        grid_file >> blob_col;

        if (grid_file.eof()) {
            break;
        }

        area->operator[](indexof(blob_row,blob_col)) = INFECTED;
    }

    grid_file.close();
}

// You may need to alter the destructor
grid::~grid () {
    delete area;
    delete infect;
}

// You will need to alter this function to display the
// plus signs (+) next to the cells that belong to
// a counted colony.
ostream &operator<<(ostream &stream, const grid& ob) {

    for (int row=0; row < ob.rows; row++) {
   
        for (int col=0; col < ob.cols; col++) {

            stream << ob.area->operator[](ob.indexof(row, col));
            if( ob.infect->operator[] ( ob.indexof(row, col) ) )
                stream << "+ ";
            else
                stream << "   ";
        }

        stream << endl;
    }

    stream << endl;
    return stream;
}

// Replace the return statement in this function with your
// recursive implementation of this method */
int grid::count (int row, int col) {

    if( row < 0 || col < 0 || row == rows || col == cols)
        return 0;

    if( area->operator[](indexof(row,col) ) == NOT_INFECTED )
        return 0;

    if(infect->operator[](indexof(row,col)) == INFECTED)
        return 0;

    infect->operator[](indexof(row,col)) = INFECTED;

    // Recursive test the 8 point near the point
    // which area is INEFCTED and infect is NOT_INFECTED

    return    count( row - 1, col - 1 ) + count ( row - 1, col )
        + count( row - 1, col + 1 ) + count( row, col - 1 )
        + count( row, col ) + 1 + count( row, col + 1 )
        + count( row + 1, col - 1 ) + count( row + 1, col )
        + count( row + 1, col + 1 );
}
posted on 2007-11-15 20:40 DraculaW 閱讀(511) 評論(0)  編輯 收藏 引用

只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            一区二区三区欧美视频| 亚洲欧美卡通另类91av | 亚洲美女视频在线免费观看| 乱人伦精品视频在线观看| 欧美在线观看网站| 国产亚洲成av人片在线观看桃| 久久精品免费看| 久久久久久久999精品视频| 精品成人a区在线观看| 欧美国产91| 欧美伦理91i| 欧美一区视频| 久久天堂av综合合色| 亚洲精品在线电影| 亚洲综合另类| 亚洲电影免费| 亚洲乱码国产乱码精品精天堂| 国产精品观看| 麻豆精品在线视频| 欧美电影打屁股sp| 午夜精品一区二区三区在线视| 久久精品免费播放| 99爱精品视频| 久久激情视频免费观看| 亚洲精选在线| 先锋影音国产一区| 999在线观看精品免费不卡网站| 亚洲调教视频在线观看| 亚洲国产精品999| 夜夜精品视频| 亚洲国产精品黑人久久久| 日韩视频在线免费观看| 国产在线视频欧美一区二区三区| 91久久国产自产拍夜夜嗨| 国产精品久久久久一区二区三区共| 久久久人成影片一区二区三区观看| 欧美jizzhd精品欧美喷水| 欧美中文字幕不卡| 欧美人与性动交cc0o| 久久尤物视频| 国产视频久久久久| 一本一本a久久| 亚洲人成高清| 久久视频精品在线| 性欧美1819性猛交| 国产精品第一页第二页第三页| 免费亚洲一区| 伊人久久久大香线蕉综合直播| 亚洲一区二区三区免费在线观看 | 一区电影在线观看| 久久久久久久激情视频| 亚洲欧美日韩国产综合在线| 欧美激情视频一区二区三区不卡| 老司机67194精品线观看| 国产精品xnxxcom| 亚洲精品护士| 亚洲乱码精品一二三四区日韩在线 | 午夜国产精品视频免费体验区| 欧美超级免费视 在线| 老牛影视一区二区三区| 国产一区亚洲| 久久av二区| 久久嫩草精品久久久久| 国产欧美日韩专区发布| 亚洲午夜在线| 欧美中文字幕| 国产一区二区三区高清播放| 亚洲欧美日韩一区二区| 午夜视频在线观看一区| 国产伦精品一区二区三区| 亚洲一区二区三区乱码aⅴ| 亚洲欧美www| 国产精品亚洲美女av网站| 在线亚洲美日韩| 午夜精品www| 国产主播喷水一区二区| 久久久高清一区二区三区| 欧美大片一区二区三区| 91久久线看在观草草青青| 欧美福利精品| 亚洲一区二区视频在线观看| 欧美亚洲视频一区二区| 国产一区二区三区在线播放免费观看 | 欧美激情1区2区| 一本色道久久精品| 欧美视频观看一区| 亚洲欧美在线高清| 久久久夜精品| 亚洲精品视频在线| 欧美久久久久久| 午夜精品短视频| 亚洲国产精品悠悠久久琪琪| 一区二区三区视频免费在线观看 | 美国十次成人| 亚洲美女电影在线| 欧美在线3区| 亚洲人成欧美中文字幕| 欧美三级视频在线播放| 欧美专区亚洲专区| 91久久黄色| 久久精品一二三| 99视频精品在线| 国产欧美日韩不卡免费| 麻豆成人av| 亚洲在线一区| 亚洲激情在线视频| 久久大香伊蕉在人线观看热2| 亚洲国产精品123| 国产欧美1区2区3区| 免费日韩av电影| 小处雏高清一区二区三区 | 久久精品最新地址| 亚洲精品中文在线| 黄色欧美成人| 国产精品嫩草久久久久| 你懂的一区二区| 久久精品国产欧美亚洲人人爽| 日韩午夜在线视频| 欧美黄色片免费观看| 欧美制服第一页| 亚洲伊人伊色伊影伊综合网| 亚洲激情电影在线| 国产一区二区视频在线观看| 欧美日韩黄视频| 免费日韩视频| 久久视频一区| 久久黄色小说| 欧美一区二区三区在| 亚洲在线日韩| 亚洲午夜精品网| 在线视频你懂得一区二区三区| 欧美激情一区二区| 久久久综合香蕉尹人综合网| 香蕉久久一区二区不卡无毒影院| 日韩午夜精品视频| 亚洲人精品午夜| 亚洲精品综合在线| 91久久精品美女| 亚洲国产欧美国产综合一区| 海角社区69精品视频| 国产亚洲午夜| 国产永久精品大片wwwapp| 国产老肥熟一区二区三区| 欧美日韩一区二区欧美激情 | 国产精品乱码久久久久久| 欧美日韩福利| 国产精品啊v在线| 国产精品爱啪在线线免费观看| 欧美日韩中文字幕在线| 欧美日韩综合| 国产精品亚洲第一区在线暖暖韩国| 欧美视频在线播放| 国产精品免费网站在线观看| 国产酒店精品激情| 国产亚洲精久久久久久| 国内精品伊人久久久久av一坑| 加勒比av一区二区| 91久久精品国产91性色| 999亚洲国产精| 亚洲女人天堂成人av在线| 先锋影音国产精品| 久久av免费一区| 久热精品视频在线免费观看| 欧美国产视频日韩| 日韩一二三区视频| 亚洲欧美精品中文字幕在线| 久久九九精品| 欧美激情一区在线| 国产精品久久久久久久久久免费| 国产精品性做久久久久久| 国产亚洲毛片在线| 亚洲欧洲精品一区二区三区波多野1战4 | 欧美一区二区精品| 久久婷婷影院| 欧美精品在线免费| 国产精品丝袜91| 亚洲国产日韩欧美在线图片 | 在线日韩中文| 正在播放欧美一区| 久久www成人_看片免费不卡| 欧美成人69av| 亚洲欧美福利一区二区| 久久亚洲一区二区| 国产精品扒开腿做爽爽爽软件 | 欧美激情一区二区在线| 国产伦精品一区二区三区视频黑人| 伊人男人综合视频网| 亚洲午夜在线观看| 欧美激情国产日韩精品一区18| 在线一区亚洲| 欧美电影免费观看高清完整版 | 欧美激情一区二区三区蜜桃视频 | 国产主播一区二区三区四区| 亚洲人精品午夜| 久久精品一区二区三区中文字幕| 日韩午夜av在线| 免费观看日韩| 在线精品观看| 久久久国产精品一区二区三区| 在线视频你懂得一区二区三区|