Hello, everyone! I am trying to generate a random number with Java, but random with the fix number of reviewers per object.Example: I have 5 reviewers(r(i)) and 5 objects(o(j)), a[i][j] is the evaluation score that reviewer(r(i)) has evaluated object(o(j)), and my question is i want to labeled each object should have evaluated only 3 reviewers. I have tried the following code, but I still have problems: the result was: each object are evaluated by all reviewers. [CODE]double[][] a= new double[5][5]; int i,j; int [] m= new int[5]; Random rand=new Random(); for(i=0; i<5; i++ ){ for(j=0; j<5; j++){ do{ a[i][j]= rand.nextDouble(); …

Member Avatar
Member Avatar
+0 forum 3

hello :) i've Two questions to ask. i'm working on MFC SDI, i'm less familiar to MFC. i found that a way to print a string in MFC SDI is: [CODE]pDC->DrawText( " mc Test Ellipse ", &rect , DT_PATH_ELLIPSIS );[/CODE] but i have to print a 2D array in MFC SDI. so 1: how can i prind 2D array in MFS SDI? 2: i have included a Dialog Box aswell. how can i access a variable of my "xyzView.cpp" file in my Dialog Box Button's fuction? Thanks :)

Member Avatar
+0 forum 0

[CODE]//Program to find the sum of the main and right diagonals of a 2D array import java.io.*; public class Diagonals { public static void main(String[]args)throws IOException { int arr[][]={{1,2,3,4},{1,2,3,4},{1,2,3,4},{1,2,3,4}}; int maindiag=0;int rightdiag=0; for(int i=0;i<4;i++) { for(int j=0;j<4;j++) { if(i==j) { maindiag=maindiag+arr[i][j]; } } } System.out.println("The sum of the main diagonal is "+maindiag); int c=3; for(int i=0;i<4;i++) { rightdiag=rightdiag+arr[i][c]; c--; } System.out.println("Sum of the right diag. is "+rightdiag); } }[/CODE] So for this program, how exactly do I write the algorithm?? I mean, what's the standard format?? Thanks in advance :)

Member Avatar
Member Avatar
+0 forum 7

Hi All if anyone could help me that would be great! currently i have an array which enables a user to input: Student Name Maths Mark English Mark Science Mark Array: StudentArray(25,3) i have this array output the data to a listview box. Column 1: Student Name Column 2: Maths Mark Column 3: English Mark Column 4: Science Mark i would like the averages to outputed to labels. lblMathsAverage lblEnglishAverage lblScienceAverage would i use a loop to add column's 1, 2 & 3? any help would be much appreciated! i have had a right pain tryin to get this sorted. …

Member Avatar
Member Avatar
+0 forum 4

Hi, my assignment asked me to make a 3 row, 7 column array that asked the user to input amount of food for 3 monkeys. 7 represents the number of days. It should tell the user the average, highest and lowest amount for this.. Here is what I've got so far... but it seems to crash when I run it... Can anyone help me identify the problem? [code=php] #include <iostream> #include <iomanip> using namespace std; //Global Variable const int COLS = 7; //Function prototypes double getAverage (double pounds[][COLS], int rows); double getHighest(double pounds[][COLS], int rows); double getLowest (double pounds[][COLS], int …

Member Avatar
Member Avatar
+0 forum 2

Sir, i'm new here searched the forums and web. I'm a beginner and dont know C very well. The Question actually is this: [QUOTE]Write a C function called DistinctWords that counts the distinct words in its input string and prints them in the descending order of number of its occurrence. Precede each word by its count. Write a main function to test your code with different input values to demonstrate that your function is robust. The function signature in C is as follows: void DistinctWords(char s[]);[/QUOTE] Thought strtok() might help and wrote this coe: [CODE]# include <stdio.h> # include <conio.h> …

Member Avatar
Member Avatar
+0 forum 32

So, I'm working on a project for my Intro to Software Development course; it's a sudoku puzzle program. So far, I've encountered two big bugs: 1.) When I wrote the code in Visual C++, the display worked fine(it showed up on the screen as a normal puzzle), but when I copied it over to linux, it displays an entire line of the input file where only a single digit should go...Can anybody help me out with that? 2.) At the main menu, after selecting 'e' to edit a square, it tells me that the input coordinate is not valid. I'm …

Member Avatar
Member Avatar
+0 forum 1

Hello, I have a a problem copying individual words inside 2D array. Array is dynamically created and initializes perfectly, but as soon as i call my function, and if i have 2 or more spaces between the words, its copying the spaces inside the next index element of the array. Am I missing something? Any help is appreciated! Thank you [code=c] void strToArray(char** my2D_Container, char* my_String){ int j = 0; int p = 0; for (int i = 0; my_String[i]; i++) { j = 0; while ((my_String[i] != 32 && my_String[i] != '\n') && my_String[i]) { my2D_Container[p][j++] = my_String[i++]; } …

Member Avatar
Member Avatar
+0 forum 1

I'm working with 2d arrays (which I kinda understand) and a bubbleSort, which I sorta but don't really understand and perhaps those * and & which I'm totally lost on, especially the * which can mean what it means or the opposite of what it means? I don't get that. The problem I'm having is converting the bubblesort given in class to one that works with 2d arrays. It should list them alphabetically and I have to use char arrays, not String - which would probably simplify it considerably. Here's the main method and my bubblesort method, I have alternate …

Member Avatar
Member Avatar
+0 forum 7

i have a problem with a program which gets a matrix[3][3] (with values 1-20.) i want to print the index of cells whose surrounding cells all have lower values. in a matrix 0 0 0 0 1 0 0 0 0 it supposed to print only [1][1]. can someone look at my check_mat function an tell me how to repair it? thanks in advance. [code=c] #include <stdio.h> #define N 3 #define M 3 int IsInside (int i, int r); int GetNum (); void get_mat (int mat[N][N]); void print_mat (int mat[N][N]); int sum_mat (int mat[N][N], int i, int j); int check_mat …

Member Avatar
Member Avatar
+0 forum 9

The End.