Hi community,

I having trouble in displaying on of my result in 9 X 9 matrix which suppose to do so.

I have commented on that line which suppose to produce the result.


Code:
#include <stdio.h>

#include <stdafx.h>

#include <iostream> 
#include <ctime> 
#include <cstdlib> 
#include <math.h>
#include <time.h>

using namespace std;

float RandomFunction(int x, int y)
{

	  srand( (unsigned)time( NULL ) );

double xmax = 0.5;

double xmin = -0.5;


int S1 = 5,R = 9;

float myarr[5][9];

float Ab1;

int c,d;

float z;


 for(int S1 = 0; S1 <= 4; S1=S1 +1) {
	 for(int R = 0;R <= 8;R = R + 1)
   myarr[S1][R] = (double) rand()/(double) RAND_MAX; 
	 z = myarr[S1][R];
 Ab1 = (xmax + y *(xmin-xmax))/2;
        //print out the values: 

 printf("Ab1:%.4f ",  Ab1);//this part will display only 1 result but I want it to be displayed in 9 x 9 matrix

 printf("\n");

 return Ab1;


 
	 } 
};








 
int main()
{
	int i, j;
	float A[9][9] = {{196, 188, 248, 0, 0,232,25,255,32}, {35, 15, 42,223,255,255,255,25,35},
	{234,236,222,224,205,231,45,205,34},{232,244,225,255,251,247,255,251,247},{59,44,40,0,0,38,15,10,38},
	{244,228,226,255,251,246,25,25,24},{243,251,208,249,238,190,249,238,190},{57,48,35,255,233,236,55,53,36},
	{226,230,234,235,240,250,235,240,250}};
   
    int m,n ;
	float B[9][9] = {{208, 245, 248, 255, 255,237,25,27,24}, {16, 21, 52,255,255,255,208,237,241},
	{235,45,218,243,211,231,21,35,36},{255,237,255,247,212,222,20,255,218},{44,13,55,22,28,12,34,15,54},
	{229,231,245,255,27,255,234,243,222},{211,236,244,254,194,21,255,216,190},{34,55,56,255,255,245,34,10,15},
	{247,234,277,219,244,255,21,244,238}};

	int q,r;



   
    // print the whole array
    for(j = 0; j <= 8; j = j + 1)
    {
        for(i = 0; i <= 8; i = i + 1)
            printf("%.4f ", A[j][i]/256);
		printf("\n");
     }

	

	 for(n = 0; n <= 8; n = n + 1)
    {
        for(m = 0; m <= 8; m = m + 1)
            printf("%.4f ", B[n][m]/256);
		printf("\n");

		     }



	 getchar();


	  RandomFunction(q,r);

	//AB2 =  RandomFunction(q,r);



	 
 

 getchar();


};