General C++ Programming - November 2014 (Page 23)

by Noori
MakeFile
 
Hello, Lets say that i want to use makefile in Unix, i have the following files inside (/home/makefile/) which are: main.cpp factorial.cpp Hello.cpp and...
[6 replies] Last: Yes. Fixed above. (by Duthomhas)
What is wrong with my c++ code
 
Platform : c++, compiler: GNU gcc I am new to programming and have written the code for the following program. PROGRAM: Input 2 arrays => arrays 1 and 2 f...
[2 replies] Last: Thanks for the reply. I have change while(sum ==1) to while(sum !=1) ... (by abdcode)
Virtual function in c++
 
Hi everyone, i have an exercise using virtual function. I understand virtual function when use it with pointer. But i dont understand what this exercise want me...
[6 replies] Last: "Now, add horse (70 km/h) into that box, how the program changes?" Th... (by nightmaregiba)
Can't seem to get right array info
 
Description of how program output should look and work as follows... Enter the curve data(0 for thrust to end list): 0.19 14.5 0.24 6.0 0.40 4.4 1.80 4.2...
[no replies]
by juaok
Using rand() function and resetting the seed?
 
So I've actually used rand() happily without any problems so far, but now I faced a problem. I have an AI loop that initialized a random number between 1 and 2 ...
[2 replies] Last: Oh, I didn't even notice that. Yeah, I wanted to pick a number between... (by juaok)
Importing 2D array
 
Essentially what I need to do is take a text file, ("input.txt"): 4 4 1 0 0 1 1 1 1 1 0 0 1 0 0 0 1 0 And take the first two values on line 1 (4, 4) and...
[1 reply] : Since the size of matrix isn't fixed you can't use static arrays. Use ... (by rich1)
i need help to add some code for matching
 
i need to be able to make matches from the data i input, and also classifying between male and female. matches for person with specific traits (not one in the p...
[1 reply] : Look at the for loop in match() function: for(int i=1;i<=10;i++) ... (by rich1)
How can you generate and then store a random number?
 
So I have to generate a random number between 1 and 6 and then store that same random number into an int variable. Eg, if the random number is 4, that must be s...
[7 replies] Last: @MatiasMunk - Line 43: NEVER call main() recursively. It's not allowe... (by AbstractionAnon)
Difference Between circular queue and simple queue
 
Hi Everyone, is there is any body who can tell me basic difference between circular and simple queue with the help of diagram. thanks in advance
[1 reply] : The difference is in the implementation. A queue is a queue, a FIFO s... (by kbw)
by PacR
Vector of pointers , am i using delete correctly here ?
 
#include <stdio.h> #include <vector> class player{ private: int id; public: void setid(int i){id=i;} int getid(void){return id;} }; ...
[6 replies] Last: Thank you armonsafai & MiiNiPaa for your answers , also the link you ... (by PacR)
how to use data from a data file
 
I need to perform operations on data from .data file i am able to load the file but how to use the data and perform operations on it. The file had roughly aroun...
[4 replies] Last: it worked, thanks for the help. and i'll keep the advice in mind for n... (by adbharad)
by XorioZ
Optimizing my code
 
Introduction: Hi and thank you in advance. My name is Mikkel and i'm somewhat new to c++. I actually came here about a month ago to ask how to make a simple c...
[4 replies] Last: #include <iostream> #include <string> #include <sstream> bool is_dec... (by JLBorges)
No matching function for call to?
 
Every time I try to compile this, I get the error message, "error: no matching function for call to" on lines 18, 45, and 46. Basically every time I try to call...
[6 replies] Last: @ProgrammerSoul I believe you're not reading the file. It may be the ... (by whitenite1)
From While's to For's...
 
I cannot seem to switch all of these WHILE loops over to FOR loops without creating some sort of reoccurring problem with the formula processing. I could post a...
[3 replies] Last: Oh sorry I didn't not read completely . (by moufou)
linker command failed with exit code 1 problem
 
Hi Today I opened my program to double check if there was any bugs in my code and unfortunately it appears that the bug its my function prototype by the mes...
[4 replies] Last: To WildBlue and Peter 87. Yes, it was the spelling of the function. Th... (by soldier10)
Help making a shell
 
Hello so I am a bit rusty, and by that I mean like SUPER rusty. I have this program that creates a file system and then I need to make the shell to interact wi...
[no replies]
Confusing Problem
 
So, I have no code for this yet.. I cannot even understand the question enough to know where to begin. I was hoping someone would be generous enough to explain ...
[3 replies] Last: First question. Do you know what the collatz conjecture is? And the ba... (by d1ff1cul1010)
Inheriting Constant Members
 
Hi everyone. I just ran into two problems with the following code. The first one is that the constant variable has to be initialized. The second one is in the c...
[1 reply] : Initialize n in A's constructor. (by Peter87)
do while loops
 
do { cout << "Height: "; cin >> height; cin.ignore(1000,'\n'); if (height <= 25 || height >= 110) { ...
[4 replies] Last: Thanks rich that worked! I had never heard of that, I was thinking tha... (by nhoffmanfr)
checking file fail
 
ofstream infile; infile.open("Input.txt"); if(infile.fail()) { cout << "Error Opening File in Input" << endl; system("pause"); exit(1)...
[4 replies] Last: I had to check for a file at some point and found this lying on the ne... (by XorioZ)
November 2014 Pages: 1... 2122232425... 32
  Archived months: [oct2014] [dec2014]

This is an archived page. To post a new message, go to the current page.