48,986 Topics
| |
Hello funs2code! I have the following problem. I need to count the number of occurrences of a concrete word in a text file. I've tried to count the number of occurrences of each word at first. The following code has no errors but it isn't working! When I type in … | |
I'm working on a C++ program to convert MPH to minutes and seconds. I'm stuck. This is my code so far. It runs, but when I key a value (i.e. 6.5), the program crashes and stalls. What I am overlooking? | |
Hello I'm new to programming in general and this was one of the assignments I did. I was suppose to create a class called employee that includes three pieces of information as data members - first name, last name, monthly salary. Then was suppose to write a test program that … | |
Hi. I try to change the text color of console in C++. I know some commands like . system("color fg"); But I want to change the color of only one line of console. Is this possible? Would someone help me, please? | |
Hi I've got most of the code finished but I can't for the life of me figure out how to correctly count neighbors for the edges and corners of the array. These are the rules. If the cell is currently empty: If the cell has exactly three living neighbors, it … | |
Hello so hopefuly someone can help me but i cant seem to find the error and my teacher is in Flordia for the next week so i dont have him to ak for help. So my project was to read input from 11 .cpd files one at a time and … | |
I am trying to set up a program that will allow the user to be able input the size of sn object and then build an array from the inputted size. So basically have cin << size -then- int positioan [size] I am getting an error about having the array … | |
hello .. i just need a lil guideline... m making a program where i have to apply counting sort on the data which is comma seperated and it is written in a text file like this 59,54,40,79,38 28,98,77,71,74 24,91,56,82,51 74,36,98,29,41 39,10,52,3,24 30,5,4,70,15 29,55,40,56,23 8,94,69,13,37 79,96,54,53,29 12,29,30,99,35 63,87,64,6,6 65,56,80,37,89 total no. … | |
what is cin>> nd cout<<.whats the purpose of these in c++ or programming??? | |
my code is showing some problem, what i want it to do is that when the user hits space a ^ is shot from the position of the user and it moves +1 along y axis. here is my code: x2 = x; y2 = y // x = 50 … | |
Assist me with a code to write a program that creates an array to hold bank balances for a bank's 20 clients .The program should display the average balance as well as highest and lowest balances in C++.I was given this as an assigment thanks in advance people | |
Hello, I have code which uses the Boost formatting library. When I try to compile the code, it gives me a single error. The code looks as follows: #include "stdafx.h" #include "DataStructs.h" #include "FileIO.h" #include <sstream> #include <boost/format.hpp> ... void SaveSingleReads() // Save the single wavelength scan(s) to a file … | |
Simple Plotting of a function is to display its values within an interval [a, b] using simple symbols. For example, plotting f(x) =ax3+bx2+cx + d in the interval [x1, x2] is to display the points: (x1, f(x1)), (x1+dx, f(x1+dx)), …, (x2, f(x2)) on the screen. dx is an increment used … | |
I'm supposed to create a program to sort a names.dat file. It compiles but nothing is displayed. names.dat Collins, Bill Smith, Bart Michalski, Mel Griffin, Jim Sanchez, Manny Rubin, Sarah Taylor, Tyrone Johnson, Jill Adams, Andrew Moreno, Juan Wolfe, Bill Whitman, Jean Moretti, Bella Wu, Jeff Patel, Renee Harrison, Rose … | |
#include <memory> #include <deque> void MyFunc { std::deque< std::shared_ptr< Sprite* > > SpriteList; func_to_fill_deque( SpriteList ); for( auto i = SpriteList.begin(), end = SpriteList.end(); i != end; i++ ) { SpriteList[ i ]->spriteFunc(); // doesn't work SpriteList.at( i )->spriteFunc(); // also doesn't work } } void func_to_fill_deque( std::deque< std::shared_ptr< Sprite* … | |
Hello , I have map of the following type: typedef map < int, vectorofInts > , Now the map has finite size. Each user when he registers, he will be allocated a key. Lets say the map size is 4. U1 will be allocated in K1. next U2 on K2, … | |
| Hi, i have problem .I want to load infomrations abour person from text file. There is name, surname and some unlimited poin.We dont know how many points there is. i try to put this informations into vector<struct> person struct{ string name string surname vector<double> points } than i want to … |
Hello , I have map of the following type: typedef map < int, vectorofInts > , Now the map has finite size. Each user when he registers, he will be allocated a key. Lets say the map size is 4. U1 will be allocated in K1. next U2 on K2, … | |
|29|error: expected unqualified-id before ‘{’ token| |27|error: new types may not be defined in a return type| |27|note: (perhaps a semicolon is missing after the definition of ‘DynStack<T>::StackNode’)| 46|error: ‘StackNode’ does not name a type| ||In member function ‘DynStack<T>::StackNode DynStack<T>::StackNode(T, DynStack<T>::StackNode*)’:| |40|error: ‘value’ was not declared in this scope| ||In … | |
Hi, Im quite new to SerilaPort handling.Im trying to open a serial communication on a particular COM port.Im able to Open a new one by using CreateFile(L\\\\.\\Com5, GENERIC_READ | GENERIC_WRITE, 0, // exclusive access NULL, // no security OPEN_EXISTING, 0, // no overlapped I/O NULL); But I want to do … | |
Hello, please help me to resolve these question c++, I try to answerd it but i do not understand anythings(": 1- A program should red in values until a negative value is read. It should determine the smallest value that was read and display that value once the loop stops: … | |
Hi Friends! If I have number of arrays with fixed size (15), it consist of zeros and non-zeros. eg: array1[15]={5,5,0,0,4,4,4,0,0,0,1,0,0,0,3} array2[15]={1,0,0,0,0,7,7,0,0,3,0,0,0,0,2} array3[15]={6,6,6,0,8,8,8,0,0,0,3,3,0,0,4} ........... How can I count the common zero sequences and there indexes of arrays? sample output for the above arrays: Index Nim_of_zeros 3 1 7 2 12 2 … | |
I found this site http://www.guyrutenberg.com/2007/09/22/profiling-code-using-clock_gettime/ If I have a server-client code and this: clock_gettime(CLOCK_REALTIME, &time_a); // create socket clock_gettime(CLOCK_REALTIME, &time_b); // close socket If I have a and b wand want to measure the time it takes to communicate, what's the best way ? Still not fully understanding the exact … | |
//Reading the last name from the file ifstream file; file.open("studentName.txt"); char name[20] ; file>>name; cout<<"The last user was: "<<name<<"\n"; file.close(); //Replace the last student name with the new one in the text file cout<<"What is your name?: "; cin>>name; name[0]=toupper(name[0]); ofstream file2; file2.open("studentName.txt"); file2<<name; file2.close(); When I run the program … | |
Hello, So I'm aware that OpenGL is Column major and DirectX is Row major, but how does that translate into a basic 1D array? So given the below visual matrix, what would the first 3 in the array of each platform and which 3 would be the x,y and z … | |
I have an array of 3,000 floats: `float *mVec = new float[3000];` and I need to take the log of each element. I am translating MATLAB code, in which everything is vectorized (ie, log(mVec) does some parallelization behind the scenes). There must be a better way to do this than … | |
private: GradedActivity *grades[NUM_GRADES]; public: void setLab(GradedActivity *activity) { grades[LAB] = activity; } Totally confused with this one. | |
Hi! A task was to solve a problem using threads (sum up two arrays), but so that you have a global const which will represent number of threads you want to use. Somehow, this doesn't work, and Im not sure if this is correct way to do it. Thanks for … | |
iclude<iostream> using namespace std; int main() {cout<<"hello daniweb"<<'\n'; return 0; } | |
Hi i created a text file and put some numbers to it but when i read from it, the last number will be printed out twice #include <iostream> #include <fstream> #include <string> using namespace std; int main() { ofstream newfile("numbers.txt", ios::out); if (!newfile){ cout << "File not found" << endl; … |
The End.