1. ## Infinite Loop

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 High=100;
int Low=0;
cout<<"The Cell has died due to defficiency of resources";
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;
}

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){
}

int Rough_Endoplasmic_reticulum(int &water_in,int &carbon_in,int &oxygen_in){
water_in-=1;
carbon_in+=1;
oxygen_in-=1;
return 0;
}

int vacuole(int data,int index){

int information[20000];
information[index]=data;
int nextindex=index++;
return nextindex;

}

int main(){

//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;

}
}```

2. O_o

An offhand guess says that you aren't ever actually calling any routines which dump any output.

Soma

3. don't call srand() more than once. only the last call will have an effect anyway. also, your formatting could use some work. try to be consistent with bracket placement and indentation.

4. Use srand like this:
Code:
`srand(time(0));`
That's all.
Make sure you leave that at the top of your main so it will only be called once.

Please look up and learn about nice indentation of code. The compiler may not care too much about where whitespace goes, but we do! We need to be able to read it very easily. If it's at all difficult to read, some percentage of readers will just not bother trying to help.