C++ console shooter Game code malfunction


I am a beginner in C++ and I was trying to make a Zombie Shooter game in console and am on android, using CppDroid as compiler. I am encountering problem in the printing of bullets and I am using an array to store all bullets, but somehow the array only prints one bullet, as I have disabled the for loop as it inexplicably prints tens of bullets randomly. The code is submitted below, and if you need it, I will send the header files too, but I think it unnecessary. Please also tell me how to make a proper bullet printer and a reliable method to spawn and despawn ‘zombies’, if possible.

Code ::


#include <iostream>
   #include <stdlib.h>
   #include <unistd.h>
   #include "functions.h"
   #include "kbhit.h"
using namespace std;
//Note to me : I am feeling sleepy and am going to sleep so I cannnot put a correction to a dumb mistake in practice now, so future self, when You wake up just make sure that while initializing the position of the bullets and their dir in logic part of the prigram, just make it so that the X, Y or whichever axis is less  dominant in the role get proper representation, for e.g.;-, I should write "if(Dir=0){bullY(BulletCount) = charlocXY(0)-1;BullX(BC)=char_locXY(2)}
// note to me, scrolling menus may be easy. All I think I must do is create a 2 element int array which tracks where the viewer is viewing. It may me finicky, but it will work.A string array will carry the text to be printed and a int range_low and range_high will record where on the screen the user is.
//declarations
//Direction convention for this file.
//up = w,down =s,left=a,right =d and attack = f,0= inert.
//essentials
char Input;
bool gameover;
bool ingame = false;
int height = 25;
int width =40;
int dir = 0;
//humans
const char Char(4)= {'{','}','|','|'};
int char_locXY(2) = {0,0};
char human(3) = {'&','@','|'};
int warrior_count(20);
int warrior_locY(20);
int warrior_locX(20);
int civ_count(20);
char civ_dir(20);
int civX(20);
int civY(20);
//zombies
int ZombieLimit = 60;
const char zombie(3) = {'(',')','/'};
char zombie_dir(60);
int zombie_count(60);
int zombieX(60);
int zombieY(60);
//bullets
int BullLimit = 90;
int BulletCount;
int bullX(90);
int bullY(90);
int BulletDir(90);
char bullet ='*';
//char BullDesc(90)  For when multiple weapons are created
    char input(){
    if(_kbhit()){
  `
    enter code here
`  Input = getch();  
return Input;                         
}
}
void menu(){
}
void setup(){
bool gameover = false;    
char_locXY(0) =RandNoGen(height);
char_locXY(1) = RandNoGen(height);
for(int i =0;i<BullLimit;i++){
bullX(i)='n';
bullY(i)='n';    
}
}
void display(){
//to make screens which allow the protagonist to move and have the screen tag along, I should set i = player_screen_lower_limit and till the upper limit of what the player should see. This will allow for a organic , unhindered potrayal of objects in the scene without a slide system 
  
cout<<bullX(0)<<","<<bullY(0)<<endl;
cout<<char_locXY(0)<<char_locXY(1)<<endl;    
//sleep(5);                
system("clear");
for(int h = 0;h<height;h++){ 
                              
cout<<"|"; 
for(int i = 0;i<width;i++){
            if(h==0){cout<<'_';}
if(h==height-1){cout<<"_";}}
            
//main display module
                                      
for(int w = 0;w<width;w++){
int i = 0;i=i+1; 
//for(int i = 0; i<BulletCount;i++){//bullet printer             
if(h==bullY(i)&&w==bullX(i)&&bullY(i)!= '/n'&&bullX(i)!='n'){cout<<bullet;} 
            
//}//Bullet printer                            
if(w==char_locXY(0)&&h==char_locXY(1)){cout<<Char(dir);}              
else if(w==width-1){cout<<"|";}                              
            
else{                
cout << " ";}
}        
cout<<endl;
}
}
void logic(){
//Player Character logic
int  BCount = BulletCount;    
    //directions {'{','}','|'};
if(Input=='w'){dir =2;char_locXY(1)-=1;Input=0;}       
if(Input=='s'){dir =3;char_locXY(1)+=1;Input=0;} 
if(Input=='a'){dir =0;char_locXY(0)-=1;Input=0;}     
if(Input=='d'){dir =1;char_locXY(0)+=1;Input=0;} 
if(Input=='p'){system("clear");  
for(int p = 0;p<90;p++){                      
cout<<"bullX"<<p<<" : "<< bullX<<" "  ;
              
}
sleep(5);      } 
  
//bullet logic 
//bullets can be updated by using the 'i' in the for loop to delete the specific element. Maybe I can use shift method of deleting an element.
    
//int BulletCount = 0;int bullX(90);int bullY(90);char BulletDir(90);char bullet ='*';
        
if(Input=='o'){if(BulletCount<BullLimit){BulletCount+=1;
BulletDir(BulletCount)=dir;
switch(BulletDir(BulletCount)){
case 0:{           
bullX(BulletCount)= char_locXY(0)-1;
bullY(BulletCount) = char_locXY(1);                 
break;                
}                
case 1:{
bullX(BulletCount)= char_locXY(0)+1;
bullY(BulletCount) = char_locXY(1);                
break;                            
        }
case 2:{
bullY(BulletCount)= char_locXY(1)+1;
bullX(BulletCount) = char_locXY(0);                
break;                            
        }
case 3:{
bullY(BulletCount)= char_locXY(1)-1;
bullX(BulletCount) = char_locXY(0);                 
break;                           
        }                                          
    }//switch 
}                   
}//if 'o' action 
//Bullet scribe
for(int i = 0;i<BCount;i++){
if(bullX(i)<0||bullX(i)>width||bullY(i)<0||bullY(i)>height){
for(int j = i;j<BullLimit;j++){
bullX(j)=bullX(j+1);
bullY(j)=bullY(j+1);
BulletDir(j)=BulletDir(j+1);                                            
        }//bullX scrapper for
                  
    }//bullX scrapper
switch(BulletDir(i)){
case 0:{           
bullX(i) -= 1; 
break;                
}                
case 1:{
bullX(i) +=1;
break;                            
        }
case 2:{
bullX(i) +=1;
break;                            
        }
case 3:{
bullX(i) -= 1;
break;                           
        }                                          
    }//switch        
      
}//for Bullet Scribe's Glory                           
//bullY(0) +=1;
//if(bullY(0) > height-1){bullY(0)=0;}
//if(bullX(0) > width-1){bullX(0)=0;}        
cout<<bullX(0);    
        
}
int main(){
while(1){
input();          
menu(); 
setup();            
while(!gameover){
input();                 
logic();          
display();
         
}
}
return 0;
}