49,761 Topics

Member Avatar for
Member Avatar for replic

Hi everyone, i wrote this small app and it works fine but it erases everything up to the offset and everything after it. Anyone knows how to avoid that? [CODE=C++]#include <iostream> #include <fstream> int main() { int hex = 0x75; std::ofstream f("sample.exe", std::ios::binary); f.seekp(1169, std::ios::beg); f.write(reinterpret_cast<const char *>(&hex), 2); f.close(); …

Member Avatar for replic
0
235
Member Avatar for integralJill

Hello, For the program described below, I obtain the correct prime numbers in the file, but when I try to output this data sorted to standard input, I get some garbage when I try it on my school network. However, when I run the same code using vmware's lamp with …

Member Avatar for integralJill
0
700
Member Avatar for zacknie

im a noobs in c++.. and my problem is i cant calculate the total,.. here is my program.... i use MSVC++ 6.0.. i hope you can solve my problem..thank you!!. [CODE]#include<iostream.h> void line(); void main() { cout<<"\t\tlist of foods:\n\n1. Yum..............................P49.00\n2. Yum w/ Cheese....................P59.00\n3. Yum with Mushroom and Cheese.....P66.00\n4. Amazing Aloha....................P88.00\n5. …

Member Avatar for zacknie
0
138
Member Avatar for txman

I'm teaching myself c++, and after searching around on the forums, I couldn't find an answer that helped me with this specific problem. The idea is to collect the first name, last name, and SSN of a customer, and create a file using the first three letters of the first …

Member Avatar for vmanes
0
94
Member Avatar for redhotspike

[code] bool operator>=(const ElementType &e1, const KeyType &key); [/code] I am trying to overload >= which compares the a string in struct e1 with a string. When I compile I get an error that: 'bool operator>=(const ElementType &e1, const KeyType &key);' must take exactly one argument ...I understand that the …

Member Avatar for redhotspike
0
71
Member Avatar for guest7

Hi, I am getting a segmentation fault at the following line in the code. I am reading a file using ifstream. The file contains some initial junk data followed by useful data. I wish to read and discard the junk data from the file, before I read the useful data. …

Member Avatar for Ancient Dragon
0
110
Member Avatar for deerowbear

I am getting an error saying, expected unqualified-id before "template" I can't figure out why I am getting this error. Any ideas? Thanks daiel code below: [CODE]#include <stdio.h> #include <stdlib.h> #include <fstream> #include <iostream> #include <iomanip> #include <string> #include <cctype> #include <sstream> //#include "comparable.h" using namespace std; // enum cmp_t …

Member Avatar for siddhant3s
0
126
Member Avatar for 00Vic

Hello all. I am a CS major and I am learning recursion right now and have a lab assignment to write a program that uses recursion to evaluate post fix expressions. I have made an attempt at this but I am stuck and need some help. Here is what I …

Member Avatar for 00Vic
0
2K
Member Avatar for noty1

Im looking for a code that shows how the directed graph is being implemented in C++ classes.Our teacher told us to use the queue algorithm. all i know is the concept of directed graph and its edge() and vertex(). But to create a program that shows how the direct graph …

Member Avatar for siddhant3s
0
90
Member Avatar for Innercoder76

Hey everyone, I've got a problem with my program and don't really know how to fix it. The program is a simulation Game of Life and has these rules: 1. A new cell is born on an empty square if is surrounded by exactly three neighboring cells 2. A cell …

Member Avatar for nucleon
0
90
Member Avatar for trebligwong

i have to do this, and my lecturer is such an ass asking us to learn it by ourselves. i have tried a code but it not working the way it is suppose to be. (Airline Reservation System) A small airline has just purchased a computer for its new automated …

Member Avatar for seanhunt
0
311
Member Avatar for JustLearning

Ok here is the code I am trying to compile remotly on a linux machine I am getting quite a few compile errors when I try to compile this Here is just a sample of the errors I am getting. [code]-bash-3.2$ gcc -o lemastsGCD lemastsGCD.cpp /tmp/cca8g62Q.o: In function `__static_initialization_and_destruction_0(int, int)': …

Member Avatar for JustLearning
0
174
Member Avatar for avadhut_ekal

I want to connect the access database to the c++ project. What are the requirements of this? How to connect that? Give the example.

Member Avatar for hasbro
0
143
Member Avatar for mimis

I have to make a tree that will have unlimited leafs in each root. I don't have much experience in binary trees and i am confused on how to make this tree. Can you help me please?

Member Avatar for GDICommander
0
106
Member Avatar for ox99racer

#include <iostream> #include <fstream> using namespace std; void namefile(ifstream & infile); void openfile(ifstream & infile); void displayScores(int scores); void getData(ifstream & infile, int scores[], int & size); int main() { } void nameFile(ifstream & infile) { cout << "enter the file name"; cin >> infile; } void openfile(ifstream & infile) …

Member Avatar for tux4life
0
107
Member Avatar for Brandon515

this is my first program ever, my email address is in the program. tell me if anything is too complicated or there are bugs and if you can tell me how to fix them. this program is me playing with fstream and it writes to a txt file or creates …

Member Avatar for siddhant3s
0
98
Member Avatar for nick2price

I am not too sure about c++. I have this program so i can perform a test on it against java. It looks like [CODE]#include "stdafx.h" #include <iostream> #include <math.h> #include <sys/time.h> using namespace std; double generate(int max) { struct timeval start; struct timezone tz; gettimeofday(&start, &tz); bool *sieve = …

Member Avatar for tux4life
0
255
Member Avatar for yaee

Create a class named Order. This class has the following attributes/ data members i) OrderID ii) Items iii) PricesOfItems a) Create the object of this class using parameterized constructor in order to initialize OrderID and Items data members. Default values of both the data members must be equal to 1. …

Member Avatar for orwell84
0
112
Member Avatar for xonxon

[code] Computer::Computer() Computer::~Computer() void Computer::setspeed ( int p ) [/code] what is this 3 sentences mean? what is the purpose we use it? i have asked my friend but still a bit blur. pls help.thanks.

Member Avatar for xonxon
0
67
Member Avatar for yaee

Write a function to overload subtraction operator for Class Order, which you created in previous question. The class has following attributes/ data members i) OrderID ii) Items iii) PricesOfItems Write the main () to call the - operator and print the result also. This operator should subtract the items of …

Member Avatar for Comatose
0
238
Member Avatar for rudasi

Hello, I just had a midterm and there was a question where we had to right a program which can calculate all the numbers which form quadruplets. A quadruplet would be x^3+y^3+z^3=a^3 The program should only run till a<25 also, 0<x<y<z<a at the end we had to output how many …

Member Avatar for siddhant3s
0
204
Member Avatar for ellimist14

ok this is a really basic question but I just can't seem to wrap my head around it. The basic syntax of how to open a file and check it and whatnot makes sense to me. But how the compiler reads from the file doesn't. For example if I have …

Member Avatar for siddhant3s
0
125
Member Avatar for FyerEgg

Ok, so I decided to try and write a simple chat bot. To start, I made it so he will scan the string that you input, and see what emotion you have. (this is just the base, eventually he will read verbs and such) So, here is the code... [CODE]#include …

Member Avatar for ArkM
0
147
Member Avatar for tomtetlaw

I have looked all through the open gl website and i cant fine where to download the SDK? can someone give me a download link? i am using c++ btw

Member Avatar for hasbro
0
81
Member Avatar for orwell84

I am writing a program that will take input and find whether or not the number you put in is prime. The program works fine, save for one small problem: [code] #include <iostream> using namespace std; int main(){ int num; //the chosen number int i; //potential factors do{ cout<<"Input a …

Member Avatar for siddhant3s
0
124
Member Avatar for Taniotoshi

Hello everybody I am doing a little code to learn a bit more about C++. Do not be amazed if you find that code useless, it is mainly just for me to improve. :) This is my first C++ program and I started few days ago... [/I]One class is used …

Member Avatar for Taniotoshi
0
612
Member Avatar for Dinomike1000

Hello - I have a question about inheritance and polymorphism in C++. If one is making heavy use of inheritance and using a lot of pure virtual and plain virtual functions, are there any common practices for avoiding having the virtual functions staggered in confusing ways. By that I mean …

Member Avatar for Rashakil Fol
0
111
Member Avatar for blahblah619

Can anyone help me figure out what I'm doing wrong. I'm new to programming and for my class we had to modify the program so that it reads its input from a text file and the output of the program should go to the screen -- only the input is …

Member Avatar for siddhant3s
0
268
Member Avatar for mtramnes

Wrote this max min problem. The output however gives me the correct max but not the correct min. It simply returns 0 for the min everytime. Any ideas what I need to fix? [code] #include "stdafx.h" #include <iostream.> #include <conio.h> using namespace std; int main() { const int NUM_DAYS = …

Member Avatar for vmanes
0
116
Member Avatar for viki0077

Can anybody give me some tip or help me with some part of this problem, thank you. Write a program which creates N new threads (N is the command line argument). Every thread in the single of M seconds (M is also command line argument) generates random prime number which …

0
71

The End.