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

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>
            一本不卡影院| 黄色日韩在线| 国产精品久久久久久久久久三级 | 欧美大片免费久久精品三p | 久久综合图片| 亚洲精品孕妇| 亚洲欧美怡红院| 裸体女人亚洲精品一区| 欧美日韩少妇| 在线看片成人| 亚洲欧美日韩国产成人精品影院| 欧美成人午夜激情在线| 欧美不卡一卡二卡免费版| 国产精品呻吟| 亚洲午夜在线| 亚洲国产99精品国自产| 日韩亚洲综合在线| 久久精品亚洲| 亚洲午夜av在线| 欧美日韩一区二区欧美激情 | 国产午夜精品久久久久久久| 亚洲欧洲一区二区三区在线观看| 欧美在线视频观看免费网站| 一区二区三区四区五区精品| 欧美激情国产高清| 亚洲第一区在线| 日韩亚洲精品电影| 欧美成人性生活| 亚洲欧美日韩国产综合| 欧美一区二区黄色| 国产一区日韩欧美| 欧美伊人久久久久久久久影院 | 午夜精品福利一区二区蜜股av| 亚洲日本无吗高清不卡| 免费亚洲电影在线| 亚洲欧洲另类| 午夜久久黄色| 黑人巨大精品欧美一区二区| 亚洲国产精品一区在线观看不卡| 麻豆精品传媒视频| 亚洲欧美日韩电影| 欧美日本精品一区二区三区| 中文av一区二区| 在线亚洲观看| 国产欧美一区二区精品性色| 久久精品国产久精国产一老狼| 欧美高清不卡| 欧美成人第一页| 欧美日本精品在线| 乱中年女人伦av一区二区| 欧美日韩一区二区视频在线观看 | 亚洲欧洲在线观看| 欧美日韩亚洲成人| 欧美成人免费网| 国产一区二区三区无遮挡| 久久久久久久高潮| 免费欧美日韩| 免费观看亚洲视频大全| 你懂的亚洲视频| 久久久综合香蕉尹人综合网| 美女久久网站| 免费不卡在线观看| 国产资源精品在线观看| 新狼窝色av性久久久久久| 亚洲综合导航| 久久婷婷色综合| 亚洲视频在线观看网站| 欧美精品午夜视频| 欧美一区观看| 国产日韩欧美亚洲| 亚洲综合99| 亚洲精品视频一区二区三区| 在线一区二区三区四区| 亚洲夜间福利| 国产精品一卡二| 亚洲成人在线视频播放 | 亚洲私人影院在线观看| 中日韩午夜理伦电影免费| 欧美日韩国产黄| 久久夜精品va视频免费观看| 欧美久久综合| 99精品国产一区二区青青牛奶 | 在线成人亚洲| 宅男噜噜噜66一区二区| 亚洲视频综合在线| 国产精品裸体一区二区三区| 亚洲一区二区黄色| 中文在线资源观看网站视频免费不卡| 欧美韩日高清| 宅男噜噜噜66一区二区66| 午夜精品福利在线| 狠狠操狠狠色综合网| 久久综合九色欧美综合狠狠| 欧美一区二区黄| 黑人一区二区三区四区五区| 久久一二三国产| 亚洲伦理网站| 久久国产毛片| 亚洲狼人综合| 欧美电影免费观看大全| 99re热精品| 久久亚洲私人国产精品va| 亚洲欧洲日韩综合二区| 欧美午夜视频一区二区| 日韩视频精品在线观看| 欧美一区二区三区啪啪 | 欧美日韩免费观看一区| 亚洲综合精品四区| 欧美电影在线观看| 亚洲一区二区精品在线| 黄色国产精品| 欧美午夜电影网| 久久一区免费| 亚洲欧美成人综合| 亚洲国产欧美国产综合一区 | 亚洲国产成人久久综合一区| 久久久久久久国产| 老司机一区二区三区| 中文精品视频一区二区在线观看| 国产亚洲欧洲一区高清在线观看 | 欧美日韩亚洲一区二区三区在线观看| 午夜视频一区在线观看| 亚洲激精日韩激精欧美精品| 久久久一区二区三区| 亚洲在线观看视频网站| 亚洲国产欧美在线| 欧美福利在线| 久久亚洲综合色| 午夜精品一区二区在线观看| 亚洲人成毛片在线播放| 欧美成人免费全部观看天天性色| 欧美一区二区三区四区在线观看地址 | 亚洲神马久久| 91久久亚洲| 在线观看成人网| 国产在线拍偷自揄拍精品| 国产精品成人一区二区网站软件| 亚洲在线观看视频| 日韩一级片网址| 亚洲国产日韩一区二区| 欧美xx69| 欧美成人精品一区二区三区| 久久亚洲视频| 免费不卡在线观看| 免费欧美电影| 久热精品在线视频| 久久久久久久一区二区| 久久激情视频免费观看| 欧美一区二区私人影院日本 | 99精品国产福利在线观看免费 | 一区二区三区四区五区精品视频| 欧美色精品在线视频| 欧美亚洲网站| 欧美在线免费观看视频| 亚洲精品在线看| 亚洲黄一区二区三区| 亚洲精品五月天| 在线视频免费在线观看一区二区| 在线视频亚洲一区| 亚洲欧美高清| 久久久精品网| 亚洲影院在线观看| 欧美一级久久久| 久久综合九色综合久99| 欧美国产综合| 国产精品久久国产精品99gif| 国产精品无码专区在线观看| 国产一区二区三区日韩欧美| 一区二区在线观看视频| 国产欧美精品日韩区二区麻豆天美| 国产精品揄拍500视频| 精久久久久久久久久久| 亚洲免费高清| 欧美一区二区在线播放| 免费久久久一本精品久久区| 亚洲三级性片| 欧美在线高清视频| 欧美激情一区二区久久久| 国产精品卡一卡二| 在线免费日韩片| 亚洲一区二区三区在线| 久久国产日韩| 亚洲茄子视频| 香蕉久久夜色精品国产| 欧美freesex8一10精品| 国产精品入口| 日韩视频亚洲视频| 久久久久国产精品www| 亚洲国产精品久久久久秋霞影院 | 国产精品一国产精品k频道56| 国内精品久久久久久久影视蜜臀 | 亚洲一二三四区| 久热精品视频在线观看一区| 在线亚洲自拍| 欧美国产精品中文字幕| 国产一区再线| 亚洲欧美一区二区激情| 91久久精品日日躁夜夜躁国产| 亚洲欧美一区二区三区极速播放| 欧美电影在线观看完整版|