Hi guys. I need help I have a code that uses asks for the users input for the map size and asks for the number of missiles or tries. the program should display 2 objects. 1 is the target and the other 1 is the missile. the target should be random and the missile should also be random. help me guys. my project/exam is overdue since yesterday since my partner bailed on me.
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <windows.h>
usingnamespace std;
int main ()
{
int x = 0, y = 0;
cout << "Enter map size: [20max] : ";
cin >> x;
cout << "Enter # of Missile(s) : ";
cin >> y;
for(int z = 0; z <= y; z++){
Sleep(1000);
system("CLS");
cout << "Enter map size: [20max] : " << x << endl;
cout << "Enter # of Missile(s) : " << y << endl;
cout << "Missile(s) Fired : " << z;
}
//this should be the map size and the grid
//the user should determine the map size but only 20 max
char grid [x][x];
for(int col = 0; col <= x; col++){
for(int row = 0; row <= x; row++){
grid[row][col];}
}
//this should be the objects
//I don't know how to do this guys..Help me!!!!!!!
//P.S just a beginner
for (int a = 0; a <= y; a++){
}
return 0;
}
So... you're telling us that you want us to do your exam for you... How about you ask for hints and pointers rather than ask us to do your test for you?
I might also add that asking someone to do your test\homework for you will make you a pretty useless developer. Think through the problem, bring your questions here. You just gave us a chunk of code, with very little detail as to what it's supposed to do and how it's supposed to look, and tell us to get to work essentially.
Oh sorry for not specifying I just want some pointers on how to make grids or arrays... and how to make objects appear on the grid...its ok if you do not give me the answer to code.. our teacher did not teach us how to use arrays and how to make grids.. he just gave us the exe. program and gave us only 3 days to work it. Im only 16 and im sorry if you think that I'm asking for answers.. I searched the internet on grids and still can't find any pointers. 'm using code blocks