I would appreciate some help troubleshooting this if-else statement. My program seems to be bypassing it and carrying out the content without asking for the input of the variable control. I would like to be able to input a value for control that will dictate whether it should carry out the if or else statement. ..
Category : io
I am writing a small program in which I have to search for smallest and largest element entered. The thing is I have made an array 10 elements wide and the user should enter at least 5 element. If the user enter less than 5 elements I want to prompt insufficient elements. This is the ..
my problem is that my stream insertion operator function returns a string like "0x55d55d9a6eb0" when I try using it through cout instead of a multi line descriptive string which comes from the output << line, here’s the relevant code. For context, it’s a template class which has a stream insertion operator trying to print out ..
I’m supposed to write a program that reads positive integers from a file and finds the sum of the even numbers as well as the sum of the odd numbers and outputs it. I can’t get the input file to be read correctly, right now it just outputs a very large negative number. I’ve looked ..
I wrote a program that calculates cylinder and rectangle areas with user inputs. But I want improve my code. When user enter a character instead of number, it should output an error message. So I wrote some extra code but it’s not working correctly. #include <iostream> #include <ctype.h> using namespace std; class area_cl { public: ..
For a particular question, I need to perform calculations on a floating number, round it off to 2 digits after the decimal place, and assign it to a variable for comparison purposes. I tried to find a solution to this but all I keep finding is how to print those rounded numbers (using printf or ..

We have two types of machines (old and new) very similar : same motherboard, same Windows 7 version, same capacity, … with a slight difference in the BIOS and CPU versions. The driver and the PCI device work well on the old machine. For some reasons, the driver (or Bios, or OS) assigns a very ..
I am trying to read this file that looks like this: 0000000 0000000 0000000 0000000 0000000 0000000 1 I’m reading it with this code: int n; for (int i = 0; i < 6; i++) { vector<int> row; for (int j = 0; j < 7; j++) { f >> n; row.push_back(n); } gameBoard.push_back(row); } ..
I am trying to read this file that looks like this (gameboard with 6 rows, 7 columns), and want to store the last value in a variable int called nextMove. 0000000 0000000 0000000 0000000 0000000 0000000 1 I’m reading this input file with this code: ifstream f; f.open(input_file); int n; for (int i = 0; ..
The file you are to read, modify, and save is a binary file that contains a sales list. A binary file is a non-text file, meaning some things (like numbers) aren’t stored as digits but as the ints/floats you use as variables. The name of the files to read and write will be in Util.h. ..
Recent Comments