49,761 Topics
| |
I am required to generate "n" random numbers of which each random number ranges from -10,000,000 to 10,000,000. I tried using rand() and changing the range, but it only has a max range of 32,000 or so. What is a good function or algorithm that I could use to achieve … | |
The RLE (Run length encoding) compression method compresses a file by writing repeated data as a byte containing the length, then a byte of the data itself. The 'real' RLE method involves writing control bytes. The first bit says whether the following data is compressed or uncompressed. The remaining bits … | |
I'm having a problem with my code. I am doing [URL="http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=12&page=show_problem&problem=951"]Where's Waldorf[/URL] on the UVA site. I understand how I want to tackle this project, but am unable to get past a seg fault. My strategy is to pass the multi-dimensional char array of the search board to a function … | |
[CODE]please help me in doing my project in one of my subject in college. it is all about getting the GCD of fractions... can anyone tell me the logic or the formula for getting it? tnxx in advance[/CODE] | |
I am trying to boost the performance of the startup of my realtime application. I have the interfaces laided out in a xml file that are parsed in and created into a data structure. Would it be worth while for me to struture my program so that once the interface … | |
Hello DaniWeb, This is my first real assignment and am having problem with it. The program must accept a userID and pass from user. The program must also read the userID and pass from file and if it matches the one on file, the program must display success message. The … | |
I have a dynamic array which will be updated from a different test system. I am havign hard time with syntax. Can someone please help me here? Here is where I declare my vector [CODE]void TestSystem::Drive(U32 RunMode, U32 Options) { //U32 is unsigned 32 bit U32 condition; U32 i; U8 … | |
I'm writing a program that will parse and print packet information from a tcpdump file. One of the fields is the timestamp, which is in seconds. The program is reading the timestamp into an unsigned int type. I need to be able to convert the timestamp in seconds to a … | |
Me Again! This program is for exercise 5) of chapter 9 in Stroustrup's book. It was a challenge for me. I gave up on trying to use [code]getline()[/code] because it required substantial parsing of the line before I could use the input. I will add it when I am more … | |
I'm getting error: no match for 'operator>>' in 'std::cin >> aTable[i][j]' for [CODE] #include <iostream> using namespace std; const int NUM_ROWS=15; const int NUM_COLUMNS=15; typedef int TwoDimArray[NUM_ROWS][NUM_COLUMNS]; void printTable(int rows, int cols, TwoDimArray aTable); int main () { int rows, columns; TwoDimArray aTable[rows][columns]; cout<<"Enter rows and columns"; cin>>rows>>columns; for (int … | |
Hi, i'm making a simple texteditor from VB6, and i use Visual C++ as my back end. i call a function where in I will read another text file and put it in a structure. this is the function: void loadR() { ifstream file; file.open("C:/CaseStudy/CaseStudy/Rsrvd.txt",ios::in); for (i=0; i<44; i++) { … | |
[code]#include <stdlib.h> // include <stdlib.h> rather than <cstdlib> for mkstemp #include <fstream> #include <vector> #include <algorithm> #include <ios> #include <ostream> #include <cstring> #include <sys/stat.h> #include <sys/types.h> #include <signal.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <netdb.h> #include <netinet/in.h> #include <errno.h> #include <pthread.h> #include "socket_server.h" #include <c++-gtk-utils/shared_handle.h> #include <c++-gtk-utils/callback.h> #ifdef HAVE_STREAM_IMBUE … | |
Hello all, I and my friend are preparing for a small OS, He's currently making the bootloader, and i'm making a Portable Executables(PE) Loader that reads PE file (EXE, DLL, OCX) and executes them... My questions are: 1) Can this PE Loader execute Win32 programs on non-Window OS? 2) If … | |
Hey everyone! I'm writing some program and im using a vector tp hold pointers to objects.. i will create new instances of the objects and my code should automatically destroy each object present in the vector. theres three types of classes stored in the vector : BaseClass, ChildClass1(inherited from BaseClass) … | |
Hi guys, I need to write a piece of code which takes two strings (char arrays) containing hex values and perform an AND operation on them. (The aim is to mask bits from the first value). A Mask value of all Fs means that we don't want to mask any … | |
Hello guys, I want to use structure as a map key , is it possible? Or is there any work around in c++ to do this or am i doing something wrong? I was trying to do this. [CODE] #include <iostream> #include <map> #include<stdint.h> #include "stdio.h" using namespace std; struct … | |
This is about a C++ problem.[CODE][/CODE] I have an object tracking program that takes images from 0,...,n in a loop. At current frame the computations are based on previous frames, therefor I need to hold those variables, matrices, etc for later use. This program has to be integrated now into … | |
I have a string in char a[100]=00110010 which is the ascii code of '2'. Now i want to write this in a text (or binary) file as binary bits. So that when i open the file in binary mode and read a character char ch say via [CODE]ifstream fin; fin>>ch; … | |
Hi...I'm a new one in C++. Would you like to explain how to plot graph in C++?? There are any web will help me to do it??? Thanks!!! | |
Hello all, I am getting the following linker error when I try to pass an object of type "string" to a function. Otherwise, the code compiles correctly. exercise_3.10.obj : error LNK2019: unresolved external symbol "void __cdecl reshuffle(unsigned int,unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?reshuffle@@YAXIIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main Here is … | |
for (i=0, i<imax, i++) { // ... Array< complex<float>, 3 > matrix(x,y,z); // x,y,z are large and vary in each loop // ... // matrix <=== values for each element assigned // ... // now want to write "matrix" in a single binary file. // later, this matrix can be … | |
im trying to run this code that adds a name and displays it. i keep getting the same message. can anyone tell me what i have done wrong? thank you. [code=cplusplus] #include <iostream> #include <string> using namespace std; class treenode { public: string data; treenode * left; treenode * right; … | |
Hi I have a file (.txt) I need my program to read that stores information like this: [CODE]Thomas 2000 Bill 3000 Jake 3500[/CODE] At which point I need to have the user input via cin, [I]name of the person[/I] ie: Jake and have them input another cin(double) which will multiply … | |
I have to do a program for my C++ class, and we have to write all programs using gedit on ubuntu and run them all using the terminal command prompt. I dont know what the whole ./a.out is, and all i have for my program is [CODE]// This program will … | |
[CODE] #include <stdio.h> 5 6 #define MAX 100 7 8 int main(void) 9 { 10 char msg1[MAX], *p, *q, msg2[MAX]; 11 12 printf("Enter a message: "); 13 for (p=msg1; p<msg1+MAX; p++) 14 { 15 *p=getchar(); 16 if (*p=='\n') 17 break; 18 } 19 20 for (p--; p>=msg1; p--) 21 { … | |
C is a programming language originally developed for developing the Unix operating system.Then c++ ? | |
I've written a flexible quicksort module capable of taking a vector reference pass, cloning it, altering the clone and swapping with the original to print the list. For the most part, this works wonderfully, except for one thing. Occasionally, it gets numbers wrong. Not all the time. If I give … | |
Hi there! My name is Ken, and I'm an old (not age) C++ programmer. I went to school for it, and it's been about 7 years since I've actually programmed anything hard, so I figured a forum would be a great place to relearn alot of it by teaching what … | |
Hi, I have the following managed c++ code: [code=cplusplus] DWORD addr=(obj.addresshigh*0x10000)+obj.addresslow; [/code] and i use this address to read memory in a program.. However I noticed it was crashing because it's adding wrong. Ie: obj.addresshigh=4006 obj.addresslow=d6b4 however addr ends up as 4005d6b4 the weird thing is this doesnt always happen, … | |
Im trying to create an object of my CAMERA class in my APP class, but I am getting the error: error C2146: syntax error : missing ';' before identifier 'myCam' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C4430: missing type specifier - … |
The End.