Hello all. I am having difficulty getting my program to output data correctly. I have a class member function that is supposed to return the value of a specific member of a struct element based on identification with its (the struct element's) other members. [code] float MatrixType::valueAt(int i, int j) const { // code to return the float value at // significant location row i col j if(i == matrix[length].row && j == matrix[length].col) return matrix[length].value; // checks to match up row and col to find correct value else return 0.0; } // end accessor valueAt[/CODE] The matrix[] array is …

Member Avatar
Member Avatar
+0 forum 6

I've been scouring the internet and my textbooks and haven't found any good explanations about how to incorporate hexadecimal numbers into my C++ code. I am currently working on a program that acts as a simulated computer environment to run a simulated machine language in the console a maximum of 16 instructions long. I already have the code required to read the instruction set from a .txt file and am working on loading it into an array representing memory. I know that machine language instructions are hexadecimal instructions 4 bytes long. My problem is trying to find a way to …

Member Avatar
Member Avatar
+0 forum 8

I'm reading about two-dimensional and multi-dimensional arrays at the moment in order to better organize user input. I'm trying to create a function that can store a card player's hand. At the moment I'm just brainstorming how it would look and writing out some notes to myself to organize it in plain english before I break it down into C++. So far I've figured this: I'm going to use a two-dimensional array to store cards in a dealt hand. I figured it would have two columns, one to store the card's value and one for its suit. So something like …

Member Avatar
Member Avatar
+0 forum 3

I am currently writing a program that can calculate the number of total seconds in a user given number of hours, minutes, and seconds (in that order in hh:mm:ss format hh, mm, and ss being any number from 0-99). I'm not really worried for checking for errors in user input, I'm more concerned with the user inputing code into the console in that format (hh:mm:ss). Example: Enter time in format hh:mm:ss: 2:15:30 Number of seconds is 8130 This is my program so far: [CODE]#include <iostream> using namespace std; int secToCalc; int minToCalc; int hourToCalc; int secLeft; int minLeft; int hourLeft; …

Member Avatar
Member Avatar
+0 forum 6

The End.