49,757 Topics
| |
Hello i am using a public computer (im just starting out with c++) so i dont have the code on me but i have figured out how to create a text file. what i want to know is when i create it, it places it in the direcotry that my … | |
The assignment is to, using the given header file, write an implementation file, a menu-driven test file, and a car wash simulator... [B][U]Please see attachment for complete instructions[/U][/B] This is what I have so far, I am having trouble with my print function... I am new to Queues and not … | |
Basically I want to set up a 3-dimensional array, but I want to dynamically allocate memory for it. Say I read 3 variables from a file, all ints: f, s, and v. i want to allocate memory for array[f][s][v] array is part of a struct How would I go about … | |
Hey guys i'm taking a c++ class and I know this is easy material but im not sure if a function call can have like m+n or FMAX and stuff. Any help with this would be great thanks. Determine which of the following function calls are invalid and explain why. … | |
Hi I need help with the remove function in the AVL tree void remove( generic x ); Thank you guys | |
I have written the code below to highlight words in quite large documents. Problem is: 1. It needs to be case insensitive, ie: "dog" or "Dog" should match "dog" 2. It currently matches words inside other words Can anyone help? Many thanks [CODE=cplusplus]void highlightTerms(vector<string> finalWords, string *source){ for (int i … | |
Hello, I just downloaded the latest gd library, unziped it - i downloaded a dll version and a source code version. I have problems whit using it in my msvc application. I will paste here the install specifications for visual c++ users : [code] [I]Instructions from the gd site :[/I] … | |
Hello! Is there any way that I could create a loop that will user the content from a text-file and the number of lines? I want to go through a file and look for something, and then I need to use line by line, not char by char. Maybe the … | |
Hey I'm new here to these forums and I'm in need of some help with my program. I'm supposed to write a program that will allow the user to enter up to 100 values into an array. The program will then count how many values were entered and display the … | |
Help please, just made this little program, no errors but it does not write any text for me on Dev-C++. [code]#include <iostream> using namespace std; int main() { system("title Array Program."); int myArray[5]; int loop; for (loop = 0; loop > 5; loop++) { cout << "Value for myArray[" << … | |
I've recently made a pi calculator out of a pretty rediculous algorithm (which is incredible accurate by the way). Unfortunately, C++ doubles can only hold 16 digits of it! I know that's plenty enough for any practical applications, but I want more accuracy! (Call me insane). I'm just looking for … | |
Hello! The text file is separated by tabs..I have used a struc as below: [CODE]struct scores { int maths int phy; int bio; int chem; int eng; int total; }; struct class { int class_id; char name[50]; }; ifstream fin; fin.open("marks.txt"); char buf[100]; string a; getline(fin,a); char delims[] = "\t"; … | |
I was given this code by my professor [CODE] main.cpp #include "home.12.h" int main() { cout << mystery(30) << endl; return SUCCESS; } // end of main //========================================= functions.cpp #include "home.12.h" int search(int first, int last, int n){ int returnValue; cout << "Enter: first = " << first << " … | |
I use the following code to read data from a txt file: File2Open = "data.dat"; if((In=fopen(File2Open,"rt")) == NULL) { Application->MessageBox("Open data file failed.", NULL, MB_OK); return; } handle = open(File2Open, O_RDONLY); do { Readin1; Readin2; }while(!eof(handle)); Readin1 and Readin2 are two subroutines and consist of many lines of fscanf(In,"%s",&TTT) to … | |
Hi, at the moment i have a program that examines a file, does some processing and then outputs the results in a file. Is it posible to examinemultiple files stored in a folder all at once, then output the report files in a seperate folder without having to run my … | |
Hi everone, Today i have a question has two parts and i did what i undrstood.If threr are mistakes ,please tell me. The Question is: [quote]father decided to buy a new vehicle. He paid 20,000 QR in cash and the rest will be paid on settlements as follows: 1500 … | |
Does anyone know the size of an enum? If i have [CODE]enum foo { YES, NO, MAYBE };[/CODE] is that 1 byte, but if i had 10 enumerations would that be 2 bytes, and so on? Thanks. | |
I have 2 classes, Edge and Point. Edge contains Point P1 and Point P2 as private memebers. Edge has accessor functions [code] Point getP1() { return P1; } [/code] and the same for P2. Point has << overloaded - [code] ostream & operator << (ostream &output, Point &p); [/code] I … | |
Hi What are the basic differences between the methods atol() and strtol()? Regards, Amit | |
Hi, I recently has a C++ code which only run on Fedora Platform. I wanted to run debugging on these code as I came across some unexplainable scenario output. Can anyone suggest how could I use any debugger? I tried to use GNU GDB but then the code I am … | |
Hi! Sorry, I couldn't find close topic. But maybe somebody can help me with my problem? I create a Word document, and I don't know how to paste the values of my variables in the document. For example, if i have the variable - int sum = 20, how can … | |
Hi, im just bored so was mucking around on Dev-C++ and then was wondering - how could i make it so my program said a random sentance, like if i defined loads, and it said one at random. Could you help :). | |
I have a class assignment of writing a program that: Start with the following program code. Write the function called "increment" which takes one integer parameter and returns that value plus one. [code=cplusplus] #include #include using namespace std; // YOUR FUNCTION GOES HERE! int main() { int input; string keepGoing; … | |
Hi ; I know how to solve the same problem if i have limit numbers ,but here i have n intergers .How can the compiler understanst me when i need n integers ,like this question: [COLOR="Red"]Write a program that takes an n number of integers and calculates their average.[/COLOR] Using … | |
why cant it work properly??? [CODE]#include <iostream> #include <fstream> #include <string> using namespace std; int main(){ ofstream out;//create output stream int acc_num[10]; for(int x=0;x<10;x++) acc_num[x] = rand()%10; //generate account number char acc_file[600]; for(int x=0;x<10;x++) acc_file[x] = acc_num[x] + '0'; out.open(acc_file, ios::out);//create & open output file out << "PACKAGE ID: "; … | |
i figure out that srand() and rand() are not quite good in creating a random number. for: [code]while(true){ int x = 0; srand((unsigned)x); int r = random(); cout<<r<<endl; }[/code] It gives back the same number. Am I doing something wrong? If not, is there anywhere that we can create our … | |
I am trying to write a "censor" program. here are the instructions: Write a program that reads a file of text and replaces each `target' word with its first letter followed by a string of asterisks that indicate its length. Have it read the list of target words from a … | |
Wow, I am having huge problems passing values between functions and wrapping my head around pointers. For some reason when I tried to return values from functions they would not pass and when I tried putting pointers in the place, passing them kept giving me compiler errors. Now I have … | |
Hi, First off apologies if this is in the wrong forum - moderators feel free to move it if it is, or ask me to repost somewhere else. Now, my actual question is as follows. If I understand correctly by initiating a hook using SetWindowsHookEx then my hook will be … | |
I have to do an assignment for class. Here is what the assignment is: Start with the following program code. Write the function called "increment" which takes one integer parameter and returns that value plus one. [code] #include #include using namespace std; // YOUR FUNCTION GOES HERE! int main() { … |
The End.