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

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 閱讀(510) 評論(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>
            欧美激情亚洲精品| 国产精品美女久久久久av超清| 国产精品视频网站| 亚洲欧美国产精品桃花| 亚洲伦理自拍| 欧美日韩一区二区在线观看视频 | 久久综合给合| 亚洲黄一区二区三区| 亚洲国产精品久久久久久女王| 免费观看日韩| 一区二区三区免费看| 日韩一区二区精品在线观看| 国产精品久久久久久久久久免费看 | 欧美国内亚洲| 亚洲欧美另类久久久精品2019| 午夜精品久久久久久久久久久久 | 日韩视频专区| 亚洲一区二区三区777| 国产一区二区三区不卡在线观看| 欧美aaaaaaaa牛牛影院| 欧美另类久久久品| 欧美怡红院视频一区二区三区| 久久九九热re6这里有精品| 亚洲成色www8888| 亚洲免费观看在线观看| 国产日韩亚洲欧美| 亚洲高清一区二区三区| 国产乱码精品1区2区3区| 久久亚洲欧洲| 欧美日韩系列| 欧美电影打屁股sp| 国产精品久久久久aaaa樱花| 免费在线亚洲欧美| 国产精品伦理| 亚洲欧洲一区二区三区| 国产一区二区三区自拍| 亚洲美女av黄| 亚洲福利在线观看| 亚洲欧美日韩国产成人| 一本一本大道香蕉久在线精品| 欧美一区二区| 亚洲一区二区在线视频| 女女同性精品视频| 久久精品一本| 国产精品日韩一区二区| 亚洲乱码视频| 亚洲国产高清在线观看视频| 亚洲欧美日本另类| 亚洲调教视频在线观看| 欧美成人精品福利| 美女视频网站黄色亚洲| 国产毛片精品国产一区二区三区| 亚洲伦理中文字幕| 亚洲免费观看高清完整版在线观看| 欧美一级久久久| 亚洲欧美在线免费观看| 欧美日韩国产在线观看| 亚洲国产精品久久久久秋霞蜜臀 | 国产精品乱码妇女bbbb| 亚洲精品小视频| 亚洲欧洲精品成人久久奇米网| 欧美一区1区三区3区公司| 性一交一乱一区二区洋洋av| 欧美日韩一区二区精品| 日韩一级黄色av| 一区二区av| 欧美日韩国产综合在线| 亚洲精品欧美极品| 日韩一级精品视频在线观看| 欧美国产综合一区二区| 亚洲精品女人| 999在线观看精品免费不卡网站| 美女主播一区| 亚洲人成绝费网站色www| 亚洲国产精品精华液网站| 美女主播精品视频一二三四| 亚洲国产日韩欧美在线99 | 亚洲黄页一区| 久久福利资源站| 久久精品国产亚洲高清剧情介绍 | 亚洲免费观看高清在线观看| 欧美电影打屁股sp| 亚洲经典自拍| 亚洲资源在线观看| 国产乱码精品一区二区三区五月婷 | 亚洲欧美另类国产| 国产欧美一区二区精品性色| 久久久久久久一区| 欧美激情亚洲另类| 亚洲视频在线一区观看| 国产裸体写真av一区二区| 久久精品国产亚洲aⅴ| 亚洲成人在线视频播放| 亚洲看片一区| 国产精品久久久对白| 午夜视黄欧洲亚洲| 亚洲高清自拍| 午夜在线电影亚洲一区| 影音欧美亚洲| 欧美日韩一区在线观看| 亚洲欧美综合| 欧美激情久久久| 亚洲欧美综合精品久久成人| 精品av久久707| 欧美精品大片| 欧美一区二区三区视频免费| 亚洲人成在线播放| 欧美在线网址| 日韩一级大片| 黄色亚洲免费| 欧美午夜视频一区二区| 久久久久久久999| 一区二区高清视频在线观看| 久久综合网色—综合色88| 一区二区三区精品久久久| 精品999久久久| 国产精品视频久久一区| 欧美二区在线看| 久久精品视频在线观看| 亚洲午夜三级在线| 亚洲国产精品99久久久久久久久| 欧美亚洲免费在线| 夜夜爽99久久国产综合精品女不卡| 国产一区导航| 国产精品久久久久久久久免费| 欧美不卡在线| 久久精品亚洲一区二区| 亚洲一区免费| 一本色道久久| 亚洲欧洲午夜| 亚洲第一在线综合网站| 麻豆av一区二区三区久久| 欧美在线免费一级片| 亚洲视频在线二区| 一区二区三区精品视频| 亚洲人成在线播放网站岛国| 亚洲电影免费观看高清完整版在线| 国产伦精品一区二区三区免费| 欧美日韩在线大尺度| 欧美精品一区在线| 欧美sm视频| 欧美高潮视频| 欧美激情精品久久久久久| 免费欧美日韩| 久久午夜av| 久久噜噜亚洲综合| 久久久天天操| 久久午夜精品| 免费日韩精品中文字幕视频在线| 久久久亚洲精品一区二区三区| 久久精品一本| 久久久人成影片一区二区三区观看 | 欧美激情一区在线观看| 欧美国产一区二区在线观看 | av成人免费| 在线亚洲欧美| 午夜精品视频网站| 欧美一级视频精品观看| 久久成年人视频| 久久亚洲精品伦理| 欧美va亚洲va日韩∨a综合色| 欧美精品激情在线| 欧美日韩妖精视频| 国产精品一区二区黑丝| 国产一区二区在线观看免费播放 | 欧美日韩国产系列| 欧美香蕉视频| 国产一区二区三区精品久久久| **网站欧美大片在线观看| 亚洲日本电影| 午夜精品999| 蜜臀99久久精品久久久久久软件| 欧美高清视频一区| 亚洲精品色婷婷福利天堂| 亚洲香蕉伊综合在人在线视看| 欧美影院在线| 欧美激情中文字幕在线| 国产精品一香蕉国产线看观看 | 欧美成人精品一区二区三区| 欧美日韩日韩| 国产三级精品三级| 亚洲肉体裸体xxxx137| 午夜精品久久久久久久蜜桃app | 亚洲欧洲综合| 翔田千里一区二区| 麻豆成人综合网| 国产精品久久久久久久久久久久久| 韩国av一区二区三区| 99re6热只有精品免费观看| 欧美亚洲一区二区在线| 欧美成人一区在线| 亚洲一区二区视频| 欧美大片免费| 国际精品欧美精品| 亚洲欧美清纯在线制服| 亚洲国产精选| 久久视频一区| 国内精品国语自产拍在线观看| 一区二区高清视频在线观看| 免费亚洲婷婷|