49,761 Topics
| |
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(); … | |
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 … | |
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. … | |
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 … | |
[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 … | |
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. … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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)': … | |
I want to connect the access database to the c++ project. What are the requirements of this? How to connect that? Give the example. | |
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? | |
#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) … | |
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 … | |
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 = … | |
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. … | |
[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. | |
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 … | |
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 … | |
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 … | |
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 … | |
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 | |
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 … | |
| 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 … |
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 … | |
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 … | |
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 = … | |
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 … |
The End.