Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8433027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:16:41+00:00 2026-06-10T06:16:41+00:00

I am making a program that inserts a two-dimensional array with random integers and

  • 0

I am making a program that inserts a two-dimensional array with random integers and locates the highest value to display it and its coordinates in the array.

I am using three files:

  • utils.h
  • utils.cpp
  • main.cpp.
#include "utils.h"

void fillTable(int table[ROW_COL_SIZE][ROW_COL_SIZE]) {
    for(int i = 0; i < ROW_COL_SIZE; i++) { 
        for(int c = 0; c < ROW_COL_SIZE; c++) { 
            cout << rand() % table[i][c];
        }
    }
} 

void findLargest(int table[ROW_COL_SIZE][ROW_COL_SIZE], int& largestRow, 
                 int& largestCol) {
    largestRow = 0;
    largestCol = 0;

    for ( int i = 0; i < ROW_COL_SIZE; i++) {
        for ( int j = 0; j < ROW_COL_SIZE; j++) {
            if(table[i][j] > table[largestRow][largestCol]) {
                largestRow = i;
                largestCol = j;
            }
        }
    }
}

void displayTable(int table[ROW_COL_SIZE][ROW_COL_SIZE]) {
    for (int i = 0; i < 10; i++) {
        for ( int j = 0; j < 10; j++) {
            cout << table[i][j];
        }
    }
}

My program displays an array, but it is not correct:

55302337713078127332504421405961229072248303443307961481223132483391855019110600
92808812679236602328231529150663269913935376911094217591887215022974011255316512
71103276228950168692675422850260269511370054042617128509148242205517590190271332
93168530667935211606208729747118402681321223203422069312038223266476231187148148
05966618422064721159313592422312213211891498452701498229001417726265175102184575
4298481247015001631326472115171254718059341323252489617888241851323216308-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460-858993460-858993460-858993460-858993460-858993
460-858993460-858993460-858993460The largest value located at [0] [0] is: -85899
3460
Press any key to continue . . .

The only thing I can change is utils.cpp.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:16:43+00:00Added an answer on June 10, 2026 at 6:16 am

    Should fillTable fill table? Currently it does not – it only prints to cout. Therefore, table appears to remain uninitialized.

    So, in fillTable, instead of:

    cout << rand() % table[i][c];
    

    You probably want something like:

    table[i][c] = rand();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a program that makes use of two Array Lists. I've researched
I've been making a program that uses core data. It has two entities, Medicine
I'm making a program that will display a few images from a directory beside
I am making a program that stores data in a 2D array. I would
I am making a program that automates the seperation of a csv file. We
I am making a program that graphs a line based on data inputted by
I am currently making a program that will send an email if the date
I noticed while making a program that a lot of my int type variables
I'm making a program that communicate with certain patient monitor using C sockets. I'm
I am thinking about making a program that will need to send input and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.