#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main ()
{
const int enemy = 10;
int x= (rand() % enemy;
int y;
do
{
x= rand() % enemy
}while (x==y);
enemy[x] ->shoot();
enemy[y] -> new_soccer();
}
{
// an array with 10 rows and 10 columns.
int a[10][10] = { {}, {}, {}, {},{},{},{},{},{},{}};
// output each array element's value
for ( int i = 0; i < 10; i++ )
{
for ( int j = 0; j < 5; j++ )
{
a[i][j];
cout << "[" << a[i][j] << "]";
}
cout << endl;
}
cout << endl;
for ( int i = 0; i < 10; i++ )
{
for ( int j = 0; j < 10; j++ )
{
cout << "[]";
}
cout << endl;
}
return 0;
}
I am trying to create a soccer game. i need help creating a rand with a if statement so that the user can shoot and pass. Also I am trying to keep soccer between the computer and the user. It is basically a virtual soccer game. Please Help I am started to get supper frustrated.
Line 17: You're comparing x to an uninitialized variable.
Line 19,20: enemy is a constint. It's not a class with member functions..
Line 26: The } terminates main(). All code that follows is not in a function scope.
Line 42: This statement does nothing.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.