51,593 Topics
![]() | |
Alright so I have a header file that includes another class with a pointer to a structure as a private variable. Does my second header have to be a pointer too or can it be static? [code=c++] #ifndef EXAMPLE1_H #define EXAMPLE1_H struct ex { int blah; char meh; }; class … | |
For a assignment I was to write two functions to sort a array. One using selection sort and other using insertion sort. The thing I was stuck on was the part that said, "// insert code to display intermediate permutations". I assuming that wants me to write a code to … | |
please i need help with my code below, when ever i enter a wrond password first it gives me an error which its suppose to, but when entering the correct code next it still gives me an error message. could someone help me counter this problem. cheers [code]#include "stdafx.h" #include … | |
I dont know how to explain very well, I have a class that works 100% fine.. The problem is that now I want access that class inside of other class, when I do it, things stop of working fine and gets very unstable( some few times works, but mostly times … | |
hi.....here is my code::: [CODE]int main() { srand((unsigned)time(0)); int random_integer,num,len; cout << "Random numbers: "; cin >> num; cout<<"Lenght of each numbers: "; cin>>len; for (int i=0; i<num; i++) { cout<<endl; for(int j=0; j<len; j++) { random_integer = rand() %10 ; cout << random_integer; } } [/CODE] my question is... … | |
Hey guys, How do I disable/get rid of that default exception message windows shows when you have an "unhandled" exception in your program? Here's my example code (sorry for not limiting the code's size to the problem only, it's readable enough I think): [code=cpp] #include <iostream> #include <fstream> #include <string> … | |
Hi, I need to create a function that will allow me to search for records in a struct. Any ideas if how to get started? Thanks | |
Hey guys, I've this code: [code=cpp] #include <iostream> #include <fstream> #include <sstream> #include <string> using namespace std; bool load_file(const string &filepath, string &dest){ ifstream file; file.open(filepath.c_str(), ios::binary); if(!file.good()){ cerr << "Fatal error while opening file." << endl; return false; } //get filesize in bytes from ifstream //seek end, get pointer, … | |
Hi, I have been asked to create a small programme that asks a user how many students information they would like to enter and then asks the user to enter all their information storing it all into a struct. The above is all good I know exactly know how to … | |
program that produces a report with a header line containing the total sales and total expenses. Following this header should be a table with each salesperson's name, percentage of total sales, and percentage of total expenses, sorted by salesperson's name. the text file should be like the following form bob … | |
hi guys... im having a problem figuring out exactly how to fill a dynamically allocated array of doubles. bool getData(double **x, double **y, int n) my function is passed these two pointers to pointers and, in the end, they are supposed to point to the addresses of dynamically allocated arrays … | |
#include <iostream.h> #include <string> void main() { char name[10]; int num_name; int count; cout << "How many names do you want to enter?\n"; cout << "Answer: "; cin >> num_name; int j =1; cout << "\nEnter names\n"; for (count=1; count<=num_name; count++) { cout << j << "." <<" name: "; … | |
Never done this successfully before and can't seem to figure it out... Any help appreciated. Basically this code draws my Winamp Track like this; "Song Title - Song Artist - Winamp 0:00/0:00" I would like to remove the - Winamp from the drawing if possible, any pointers or code would … | |
I am trying to make a program that computes gross by using a class and three functions. When I try to run it, it gives me this error I think something is wrong with my set function and my int main function, any help would be appreciated, I think it … | |
Hello...I'm trying to write this program answering this question and I keep getting C2440 errors and C2664 errors and I did some research but couldn't find anything on how to correct it. The question says : Write a program that dynamically allocates an array large enough to hold a user … | |
I am quite new to C++ and while trying to 'link' functions (methods?) together to make more interesting code. I found that you cannot call a function that is below the function you are calling it from. example: main() { "code" run(); } run() { "code" } This doesnt work. … | |
I can't seem to figure out why there is a segmentation fault in my copy constructor. [code]Set::Set() { Num = 0; Head = new (nothrow) Node; Head->Succ = NULL; } [/code] [code]Set::Set( const Set & A) { Node * Temp = A.Head->Succ; while ((Temp) ) { insert(Temp->Item); Temp = Temp->Succ; … | |
My homework problem is the following :Write a program that accepts a string from the user and then replaces all occurrences of the letter e with the letter x. I got the following code below that can recognize to find characters and where they are at but I don't know … | |
suppose the input file is... 5(number of cells) 1 2 -1 4 0 2 3 4 1 0 3 -1 2 -1 3 1 2 0 1 -1 how will i Write a function to read data from an input file to create a dynamic array of pointers to cells, … | |
hello all , i have to initialize the array of stucture singleIMEIarr to null , using NULL doesnt work , when i assign {'\0'} it doesnt execute. any suggestions at to where im wrong ? [code] struct singleIMEI { string planname; string plandescription; string scriptexec; string startdate; string starttime; string … | |
Hey guys I need to write a function that separates a line into five different individual fields. My first question is how do I set the entire line of input from a file to an array. These are my directions. void dissectCustLine( char *, char *, char *, char *, … | |
I'm trying to add all the square root answer but why am i getting this output: -858993430 #include <iostream.h> void main() { int input; int sqrt; int i, sum, add; cout << "Please enter your desire number: "; cin >> input; for (i=1; i <= input; i++) { sqrt = … | |
How to make a new scripting language in C++ ?...I need: parser,scanner,grammar,included functions,syntax.Where I can start?. I think I use JavaScript/PHP syntax. | |
I am working on a set class and I have successfully written an insert function, but I need the function to insert in an ordered fashion. [code]bool Set::insert( const EType & A ) { bool Flag = false; unsigned Position = 0; Node * Prev = Head; Node * Curr … | |
Hey guys, Well I have a lecture about "Fundamental File Structure Concepts". I`ve read some articles about it and I really have a problem with the File Dump part!and also I didnt find any useful thing about it in internet can anyone please help me?? thanks :) | |
<email snipped and color code tags deleted> this is the solution for this problem its kinda long and boring ,but it works properly [code=cplusplus] #include <iostream> #include <iomanip> using namespace std; void main() { const int r=4, c=4; int ar1[r][c]; int ar2[r][c]; int sum[r][c]; int prod[r][c]; int s=0, y, x; … | |
Hi, im VERY confused about this, and i get a lot of different explanaitions, so now im asking you guys, because you properly know:) What can .net be used for? what is it good for? .net vs. gtkmm? Can i use the .net framework with c++? and how? Thanks in … | |
I have a program that writes on a text file. I'm using CStdioFile to write on a text file. The problem is, once the writing size exceeds 190kb, it stops from writing and causes the program to not to respond. I tried threading in my application and the "not responding" … | |
Hello ALL, I have a vector vector<CLUSTER> ClustList; where [Code] struct CLUSTER{ string DocID_DocName; } [/code] some members of CLUSTER have been ignored for simplicityInitially, I put 3 elements into ClusterList by using push_back() the content in DocID_DocName is shown below. [Code] ClusterList[0].DocID_DocName = "0"; ClusterList[1].DocID_DocName = "1"; ClusterList[2].DocID_DocName = … | |
I have been rushing trying to get this done by Monday 2am est. I'm trying to create a new project which consists of at least two classes: a base class and a derived class. The code of your project should include * a composite object * an example of inheritance … | |
I have been trying to learn about FFT programs and have been using one of the codeprojects example as a base [url]http://www.codeproject.com/KB/audio-video/waveInFFT.aspx?fid=39693&df=90&mpp=50&noise=3&sort=Position&view=Quick&fr=1#xx0xx[/url] What i would like to know is how to go about taking the data from the fft algorithm that is used here and display that information in an … | |
Hi, How can i find the OS name in C++ on which the program is executed. like Windows 2000, Windows XP or Windows Vista? Thanks for any help. | |
Dear Friend...I urgently need your help.. Im developing application multithreaded and multiplatform File Transfer Utility...now the main function is alread working (thanks to Mr Sailen Sukul). The problem is that I want my application to have a progress status in every row.(Means that it should show the size of the … | |
I've been trying to figure this out for a while and figured I'd ask some experts: For a school assignment, I need to create a datebook program. One of the classes is a DateAndTime class. One constructor on the class is supposed to take an unsigned integer and convert it … | |
I need someone to explain to me this code step by step: [code=cplusplus] /* File config.txt: num = 123 str = hello flt = 12.2 */ #include <iostream> #include <fstream> #include <sstream> #include <string> using namespace std; struct Config { int num; string str; double flt; string myadd; }; void … | |
Hi, How can i delete the file in the middle of the program in C++ Thanks | |
Hello, I have to make a program that takes in a 2 character & out puts their eqivalent in ASCII Decimals. For example; input = j b , output = 106 98 (ie, j= 106 in ASCII table, b= 98) eg 2; input = J B , output = 74 … | |
I want to rank sentences in a text based on weights.. for example i want to extract certain important sentences from a text based on its weights(importance).. please help if possible with an executable algorithm... | |
I am currently writing a simple program that matches a already written program, with certain specifications that are required. For the most part I have written what seems like working code, but I do have problems. Here is the program that I have to make: [URL="http://mavdisk.mnsu.edu/wangj/lab10sol.exe"]Sample[/URL] 1st problem: When the … | |
Hi, I wish to remove the extra unwanted characters in the file name. [ICODE]f1::f1(char *filename1) { char file_txt[40]; strcpy(file_txt,filename1); strcat(file_txt,".txt"); system("rm file_txt"); }[/ICODE] In debug mode when i check the value of file_txt i get : file_txt = "../../input.txt\000\000\000\000F\000\000\000\001\000\000\000\001\000\000\000\v\000\000\000\002\000\000\000\000\000\000\000\001\000\000" I do not know hoe to get rid of the extra … | |
this program will replace a substring from the string with a new string . It is working perfect ... [CODE]#include <stdio.h> #include <conio.h> #include <string.h> #include <iostream.h> char *replace(char *st, char *orig, char *repl) { char buff[50]; char *ch; if ( !( ch = strstr( st, orig ) ) ) … | |
Thanks in advance for your help. Ok...the last part of this program is where I am stuck. I am supposed to read data in from a file and sort by gender. But the output is supposed to read department, gender, first, last names, job title and salary -- then to … | |
Hi all, I have been reading on the net searching for what others alternatives do i have besides singleton and i came across the following site:- [URL="http://www.bigroom.co.uk/blog/better-without-singletons"]http://www.bigroom.co.uk/blog/better-without-singletons[/URL] There is a paragraph stating:- [B]To accomplish this(singleton effect), create the class as a normal, non-singleton, class and enforce the single-instance only behaviour … | |
Does anyone know of any open source libraries that provide a simple grid (2d matrix) structure- for simple game navigation? I am running into a lot of problems with the one I created for my ai project and it would be nice to have something reliable to work with. Thanks! | |
can anyone help me with this program write in c++ a defintion of a complex class for complex numbers.Each object of this class will represent a complex number x+y*j storing the real part x and the imaginary part y as float in private section. Include a constructor, a destructor, access … | |
Why am i getting a segmentation fault when i try to compile this code? [CODE=c++]#include <iostream> using namespace std; int main() { bool x; string odgovori; cin>>odgovori; int xd[2], rez=0, vkupno=0, odlen=odgovori.length(); xd[1]=1; for(int i=0; i<odlen; i++) { if(odgovori[i]=='O') { if((xd[1]==1)&&(x==false)) { rez=rez+1; x=true; } else{ xd[2]=xd[1]*2; rez=rez+xd[2]; xd[1]=xd[2]; } … | |
How good this code in terms of clarity, readability, and overall design? Easy to understand them or not? Note: i put system("pause") which is not recommended. cin.get() is a better one in case you didn't know. [B]First: Port Scanner[/B] [CODE]/**program description: * * this is a simple port scanner * … | |
Hi guys! I've worked so hard on this really long program. I think I'll just post the relevant subprograms. I hope it's still easy to understand. This is just before the main function. [code] #include <iostream> #include <iomanip> #include <conio.h> #include <string> using namespace std; //function prototypes int cashier(); //generates … | |
hello, quick question regarding template classes and pointers. I'm making a linked list kind of container system, and I'm running into trouble with it when I (don't know if the terminology is 100% correct here) declare an instance of it. An example would be best to explain what's happening: I … | |
So im using this code to start a thread... [code=cplusplus] namespace Monitor4vc { public ref class Stats { public: Stats() { } ~Stats(){} void set(int prid, String ^url, String ^pst, String ^pth){ pid=prid; httpUrl=url; post=pst; path=pth; } void start(){ thread=_beginthread(OpenProc,0,NULL);//Error } private: ArrayList playing; ArrayList quitp; HANDLE thread; int pid; … |
The End.