I'm also a beginner at C++ so I might not answer you correctly but I might be able to give some guidance forward.
First, in your for-loops the condition r < r and c < c will cause the loops to exit immediately since 0 is never less than 0. You should use a different variable as the iterator:
Also, I think you need to initialize the rand-function with a seed using the srand-function. This is typically done using a call to time(0) that exist in the ctime-lib. See below
cout << ("how many rows are there? : ) " << endl;
cin >> r;
cout << ("how many columns are there?: ) " << endl;
cin >> c;
int grade[r][c];
You can't do this. Arrays must be declared with a size known at compile time.
What you ask for is different from this anyway. I assume you don't know about new, and therefor your teacher expects you to make an array large enough for your needs.
How to generate random numbers in a 2 dimensional array.
You need two things, a 2D array and a random number generator.
A 2D array is created like so:
1 2 3 4 5 6 7 8 9 10
constint WIDTH = 10;
constint DEPTH = 10;
int arr[WIDTH][DEPTH];
// To traverse
for (int i = 0; i < WIDTH; i++)
for (int j = 0; j < HEIGHT; j++)
// do something with arr[i][j]
To create random numbers:
1 2 3 4 5 6 7 8
#include <ctime>
int main(void)
{
srand(time(NULL)); // Do this only once in your program
int i = rand(); // i is random
i = rand() % 10; // i is random between 0-9
#include <ctime>
#include <cstdlib>
#include <iostream>
using std::cout; using std::endl;
int main()
{
srand(time(NULL)); // Seed the random number generator;
int r, c;
cout << "How many rows are there?: " << endl;
cin >> r;
cout << "How many columns are there?: " << endl;
cin >> c;
int** grade = newint*[r];
for (int i = 0; i < r; ++i)
{
grade[i] = newint[c];
for (int j = 0; j < c; ++j)
grade[i][j] = rand() % (r*c);
}
// grade[][] is now a 2d array with random numbers between 0 and r*c.
}