Beginners - April 2015 (Page 42)

Sort a structure
 
Hey everyone. The program I'm working on is going well and I'm just about done, largely thanks to all of you. There is only one more thing I need to do, and tha...
[no replies]
array display
 
I'm having trouble getting this 2 dimensional array to display as a pyramid, and i have no idea where to begin. #include <iostream> #include <fstream> #in...
[2 replies] Last: I need to figure out how to do it with an array because later on I hav... (by confusedengstudent)
by sha92
Prime Number Function
 
Hello, My code doesn't give the output, prime numbers 1-100. What have I done wrong? #include<iostream> #include<cmath> using namespace std; int n, ...
[9 replies] Last: great! it works. Thank you so much :) (by sha92)
Weather Statistics
 
Code is providing the wrong number for calculating the average monthly average temp #include <iostream> #include <string> #include <iomanip> #include...
[5 replies] Last: it is outputting the wrong number 141.867. I expected around 70.933 ... (by fg109)
Can array have a value of a struct with a couple members in a struct ?
 
Can array have a value of a struct with a couple members in a struct ? struct allCarsGarage { int carOwnerId; int carId; } Ca...
[3 replies] Last: And I wanted to use it to sort all of the cars carId ONLY You cant ... (by TarikNeaj)
Object orientation programming
 
Write your question here. Int x=20 Int y=1 If (x <0 || x>y&&y != 9) --x --y Cout <<x<<""<<y<< endl This is in the book oop c++ but when I run thi...
[3 replies] Last: This is how the book we are using for this class showed the code h... (by TarikNeaj)
freeglut warning will not go away
 
I'm creating a simple window using opengl and freeglut. #include <windows.h> #include <GL/glut.h> void display(void) { glClear(GL_COLOR_BUFFER_BIT...
[1 reply] : Is there no one who has experienced this or knows the answer? (by Remludar)
How do you sort a stack using selection sort?
 
Part of my homework includes sorting a stack using a selection sort and I don't know how to do that.. We might have done it in class but I don't remember. Basi...
[4 replies] Last: I guess pop can be considered a top function.. The public functions ar... (by agamatr)
Password Verifier, trouble verifying password
 
Trouble getting this to run through checking the password properly, please help. I have been running through this for a week now. I can't seem to find my error....
[2 replies] Last: Thank you!! I changed that and it works perfectly now. I tend to over ... (by GIjessiebear)
by adoweb
Creating objects during program.
 
Hi there, i'm creating my simlpe program about cells in petri-dish. I have class CELL with data memeber called energy a and some member functions. I can de...
[1 reply] : yesterday i learned object can't be made from variables That is not ... (by keskiverto)
integer being reset to zero
 
I'm trying to figure out why my code keeps resetting the power once entered, back to zero once the function goes back to main. Any ideas fellas? PS: This is ...
[3 replies] Last: set the power variable as a static variable. (by confusedengstudent)
by Futbol
Array
 
I've been working on a project for 3 hours now and I've got this random guessing game to work flawlessly but i'm having a hard time creating an array that can k...
[5 replies] Last: Using your code, I can only play the game once, if I type in Y or y it... (by TarikNeaj)
c-equivalent of "reference" and "reference to a pointer"
 
Could someone please let me know the c-equivalent of: 1) reference? 2) reference to a pointer "*&"? In other word, if my function is like this in CPP: void f...
[2 replies] Last: @TarikNeaj Thanks for responding. Let me first summarize what I kno... (by dkumar3)
Range-based loop problem
 
The loop won't break. //string second="45670"; //string first=""; //int max=7; for(char temp:second) { first += temp; if(temp==(cha...
[12 replies] Last: Thank you. You're talking about the second table, right? http://www.t... (by mighty asker)
How to check if argv contains a letter
 
Write your question here. if the command argument was 123abc3, how would check for the letters in that argument and cout an error, really struggling and dont k...
[1 reply] : #include <iostream> #include <string> int main( int argc, char* argv... (by JLBorges)
Insert Node
 
I want to insert a node 2,4,6, and 5 and it should be inputted that way but it outputs 5,6,4, and 2. How to fix this? #include<iostream> using namespa...
[3 replies] Last: I fixed it! Thank you! void Insert(int data) { Node*temp = new Node(... (by Vandalism)
by Lee125
symbol "->"
 
Can anyone explain I Did not understand the symbol "->". it=mylist.begin();            if (it‐>word == mystr.word)  // if word of it...
[12 replies] Last: I didn't get this symbol also (by Wilma Negron)
logical operator question
 
can someone explain to me why the output would be ans is 5?? else if (!y||!x) ans =0.5; //why it is true? #include<iostream> using namespace std; in...
[3 replies] Last: See my edited post, i mistook x for y before. Am sorry ! (by bazetwo)
Using sort() with function
 
Hello. This is my sort() function: sort(evens.begin(), evens.end(), second); ...which is using: bool second(int i, int j) { return (find_prod(i)<find_pr...
[7 replies] Last: keskiverto, Could I do the same with this ( http://www.cplusplus.com/f... (by mighty asker)
New Problem, see recent post please!
 
I'm working on a function to open a file, and mostly it works. This is the code I have based on my example: void open(ifstream& fin, vector<Person>& peopl...
[10 replies] Last: Person* match = find_person_by_firstname(myvector, "John"); if(!match... (by S G H)
April 2015 Pages: 1... 4041424344... 52
  Archived months: [mar2015] [may2015]

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