Hi,
I have been busy trying out a program which emulates the basic functions of a cell( well presently only one basic function) but i have run into a hitch. The program doesn't display my output! and i don't understand why, any help is appreciated
Code:
/* By Himanshu Goel
18 April 2012
Cell Algorithm
An algorithm designed to mimic the activity of any single cell
through the use of basic functions of any cell converted into
computer functions
*/
#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <math.h>
#define Ribosome 101
#define Golgi_App 111
#define Mitochondria 001
#define Plasma_Mem 011
using namespace std;
struct cell{
int energy;
int oxygen_in;
int oxygen_out;
int carbon_di_in;
int carbon_di_out;
int water_in;
int water_out;
int protiens;
int dead;
};
cell head;
int High=100;
int Low=0;
int dead(){
cout<<"The Cell has died due to defficiency of resources";
cout<<"/n Energy ="<<head.energy<<"/n O2 inside the cell = "<<head.oxygen_in;
cout<<"/n O2 outside the cell = "<<head.oxygen_out;
cout<<"/n CO2 inside the cell = "<<head.carbon_di_in;
cout<<"/n CO2 outside the cell = "<<head.carbon_di_out;
cout<<"/n Water inside the cell = "<<head.water_in;
cout<<"/n Water outside the cell = "<<head.water_out;
cout<<"/n The number of protiens produced is "<<head.protiens;
head.dead=12;
}
int concentration(int &object1,int &object2){
//Checks concentration between inside
//and outside and changes accordingly
if (object2>object1){
int difference=object2-object1;
object1+=difference;
object2-=difference;
}else if (object1>object2){
int difference=object1-object2;
object2+=difference;
object1-=difference;
}
int obj1=object1-(object1*2);
int obj2=object2-(object2*2);
if (object1<0||object2<0){
dead();}
}
int Rough_Endoplasmic_reticulum(int &water_in,int &carbon_in,int &oxygen_in){
water_in-=1;
concentration(water_in,head.water_out);
carbon_in+=1;
concentration(carbon_in,head.carbon_di_out);
oxygen_in-=1;
concentration(oxygen_in,head.oxygen_out);
head.protiens++;
return 0;
}
int vacuole(int data,int index){
int information[20000];
information[index]=data;
int nextindex=index++;
return nextindex;
}
int main(){
srand((unsigned int) head.energy);
srand((unsigned int) head.oxygen_in);
srand((unsigned int) head.oxygen_out);
srand((unsigned int) head.carbon_di_in);
srand((unsigned int) head.carbon_di_out);
srand((unsigned int) head.water_in);
srand((unsigned int) head.water_out);
//assign random values to the variables
head.energy=rand()%(High - Low + 1)+ Low;
head.oxygen_in=rand()%(High - Low + 1)+ Low;
head.oxygen_out=rand()%(High - Low + 1)+ Low;
head.carbon_di_in=rand()%(High - Low + 1)+ Low;
head.carbon_di_out=rand()%(High - Low + 1)+ Low;
head.water_in=rand()%(High - Low + 1)+ Low;
head.water_out=rand()%(High - Low + 1)+ Low;
while (1){ Rough_Endoplasmic_reticulum(head.water_in,head.carbon_di_in,head.oxygen_in);
if (head.dead=12){break;}
}
}