After asking the user to input 2 values i expect my program to read them and then output whether they are equal, bigger or smaller than one another. However i am getting no output what so ever when i input the values
It has something to do with the lines at the bottom of the code. It doesnt cout anything. The program just crashes upon execution. First, it asks me the amount of students i want to handle. I enter '1'. Then it asks me if i want to read in from external file and i enter 'Y'. then the exe just crashes
My problem is that I need to take a csv or excel file with tens of thousands of datapoints, write all points in a section of column to an array, perform calculations on them, and then write it back into another column.
I've been looking all over the internet for ways to do this easily. So far I have not found anything that I can follow and implement.Some codes have been slightly useful, but they aren't commented in a way I can understand. How to write code to take, for instance, lines from column b between 500-1000, write them to an array, and write another array 500 characters in column c. If that code could be commented, I have tried a few different techniques (counting commas), but haven't gotten anything to work.
My whole code is working but when the results are sent to my phone only the temperature value is reading correct the light value is all jungled up and moisture and pressure values are reading as 0.
I have a .txt with a 0 or 1 to each line of the txt file. there are many values to read. I am reading the values and calculating how many each reoccur in a sequence (run-length encode). If i only use say 50 values coming in it works, but once i do the hundreds there are in the file it hangs. i am not sure why.
I am only receiving the correct temperature value. The other 3 values are reading wrong. My format string isent matching the variable list. What I need to do.
We are supposed to split this lab into 3 files a .h and 2 .cpp's. The code I'll be talking about is going to be directed at the main.cpp file. Basically we are supposed to be able to enter as many classes into the program and when you are done the program is supposed to save the contents into a .dat file. This lab is working off of an older lab so I already have a .dat file I am trying to test with this program by reading it into my program when I first run it I prompt if the user wants to load previously entered courses and if they reply with a 'Y' the program will load the contents of the .dat file. Problem is right now when I load from the .dat file only the first class is correct. Every other class after that is just giberish. I've tried everything but can't get the restore part working. I also cannot get the save to .dat portion of this lab working either.Here is my code:
#include "Course.h" #include <iostream> using std::cout; using std::cin; using std::endl; using std::ios;
I am trying to read an array values from Tmin.txt file. I take array size from user viz. number of raw & column and then, read the following data from Tmin.txt file which look like this:
My game is a sort of RPG with stats, money etc. I just recently added a save/load system using writing to a file. I initially got writing to a text file to work, then I got loading to work too.I eventually was able to read numbers from the file and assign them to integer variables in order.
My issue was I wanted to check if a save file existed, if it did, load it up, if it did not, go to character creation. I had a lot of trouble with this and after trying different code snippets to work I finally got it to check if a file existed, and execute the appropriate code.
My issue now is my code USED to go through each entry and assign variables in order.
Like the first number in the text file would be for the variable money, and it would read it, assign to to int money and scroll to down to the next variable for player strength, assign to to playerstr variable and so on. After making the tweak for loading it no longer functions like this, and makes the last entry in the text file the value for everything.
I barely get how this code works, how can I tweak it to go through the file in order and assign variables one at a time?
At the current moment, it assigned the playerstr value to both money and playerstr int. But the save file being created lists the correct values in order.
I am trying to read hex data from a file (not just hex values in text format). I was able to read it (02 EC) with "fread" into an char before but I need to change the Hex value into an integer in decimal.
I already read about strtol but I would prefer reading the hex Value into an integer.
Here is my code so far:
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int itrack1[1]; int itrack2[1];
When i try to read it back from fstream again there are some symbols (binary obviously). How can i get my values back? I want to read those symbols and in a way to convert them to my old width and height values.
Ok I'm trying to create matrix of data that I can add values to based on a reading that I will get from a DVM. I'm using a 3d vector to do this. I need to keep track of the serial number, the day and within day I need to take two readings at different temps, this will continue for 7 days.
The rows of my 3d vector will be the days, the colums will be the serial numbers the depth will be the reading at the different temps.
What I need to do is compare the first element (days) and when it is greater then or equal to 4 I will perform calculations of the readings. So all I want to do is compare the first element of the vector, How do I do this?
I just got a job programming a windows application. One of the requirements is reading and writing values from an excel spreadsheet. Looking online, it appears that C++ isn't the best (one of the worst?) languages for reading and writing values from excel files. Now the language I'm most familiar with is C++ and I've been looking at C#, and it appears to be much easier to read excel files.
I have problem reading CSV file, i found many solutions but i still got one problem. I need to read CSV file and then these values show in List Control and here i have problem. Idk how to display it in List?
I am attempting to read values from a file into a 2d array temp[31][2] (31 rows, 3 columns).I only want the values from the file to be read into the first two columns.I believe I am accomplishing that but when I go to print the array, I expect the first two columns to have the file data and the third column to have all zeros. The third column, however is printing such that the value is the next row/first column.
I'm not sure for instance why on the bottom loop for line 1 it doesn't print:
It seem to store the entire line in userID including the ":". I want to ignore the ":"'s and store everything in between in respective varibles in the order specified above.
So first string in userID, then ignore the :, then second string in name, and ignore the next :, and so forth. How I can accomplish this?
I decided to make a linked list program using classes and templates.I implemented my linked list and added some basic functions, everything worked just fine. Then I proceeded to add templates...First, the error list:
#pragma once template<class T> class Node { private: Node* next;
[code]....
To sum up: Something's wrong with the templates that I used in "List.cpp" and what it could be.
I'm currently learning templates -- & my logic is in a knot with what I am trying to do which is the following:
-Create a function name load -Accepts a filename (the filename is a text file of integers) -Open the file -Create an array(dynamically allocating an array) filling it with the elements read in from the file & returns the array(so that the return type of the array is a pointer to the element type of the array).
//Header file: #ifndef BUBBLE_SORT_H #define BUBBLE_SORT_H #include <iostream> template <typename T> void load(std::string filename, T *&arr, int *size);
[code].....
how to allocate memory when it comes to using templates..
Now, let's suppose that I instantiate an array of 100 elements of each class:
case1 c1[100]; case2<20> c2[100];
My question is this: will c2 occupy roughly half of the memory than c1?will the value c1.n be allocated 100 times, while the value c1.n wil be allocated only once?
template <typename T> class Matrix { // some stuff and some methods };
and let's say that you have some methods that need to do some type-dependent stuff, like, for example,
template <typename T> Matrix<T> Matrix<T>::transpose() const { // get this->rowCount, this->columnCount // create a Matrix that has rowCount amount of columns and columnCount amount of rows // copy (*this)[j][k] to theMatrix[k][j] (for all of the entries in *this) // if the entries are complex, take the complex conjugate of them all }
Would it be good practice to check explicitly for the typename parameter (or is this, somehow, defeating the purpose of templates)? std::cout << "I know that this is a design question, but it needs to be asked... ";