General C++ Programming - October 2014

c++ else if statement
 
void printScores() { for(int s= 1; s < 25; s++) { if(testscores s = 0 && testscores s = 24) { total ++; } else if(testscores ...
[3 replies] Last: doug4 explained how to fix your code. But this can easily be calculat... (by zoran404)
Array of 10000, display only 5 problem
 
#include <iostream> #include <iomanip> #include <ctime> #include <cstdlib> using namespace std; const int size = 10000; int NUM ; void insertVAL(int ...
[1 reply] : for(int k = i; k < (k+2); k++) Your problem is here. The value k w... (by doug4)
strcmp weird error?
 
Hey. I am getting an error in finding node in BST. Is there any difference betwee if(strcmp(root->barcode,item.bar)<0) AND if(strcmp(item.bar, root->barcode...
[1 reply] : Well the second one has a stray comma after 'barcode' that would preve... (by Disch)
Names with spaces
 
I was previously talking about this in a seperate thread, but it was nothing to do with the topic so here's my question. Is it possible to make a class whose na...
[5 replies] Last: Okay, thanks. I was just basically wanting my version of int to fit in... (by shadowmouse)
Question about goto Statement
 
int main () { char buffer ; fgets(buffer, 256, stdin); for (int i=0; i<21; ++i) { if (buffer !=' ' || buffer !='-' || buffer !='/' || b...
[3 replies] Last: #include <stdio.h> #include <string.h> #include <ctype.h> int main()... (by JLBorges)
Unscrambler
 
This program should be easy for those who are experienced //not me So i want to make a simple word unscrambler but dont know how //obviously I am thinking tha...
[7 replies] Last: The aha! insight is to sign each word in the dictionary so that words... (by JLBorges)
Why this code is not giving output?
 
Why this code is not giving output? When the input value of n>1. // Example program #include <iostream> #include<cmath> using namespace std; int main() ...
[1 reply] : What is it supposed to do? (by kbw)
Nested if-else
 
Hi, When I key in N or n, it will state as "Congratulations! You are qualified to apply", when it should actually be "Sorry, you are not qualified to apply b...
[3 replies] Last: Thank you! =) (by missjune)
just a question
 
hey guys i was practicing c++ i just want to ask if this type of program is an example of recursion? #include<iostream> using namespace std; int rec...
[4 replies] Last: no i understand it now thanks . (by theposibility)
please i need to learn this
 
i have a question how does this line work out //(base * recursive(base, total -1);// im confuse because you have 2 arguments first is base and second is total...
[2 replies] Last: thank you so much (by theposibility)
Storing objects using std::vector
 
I have two classes, Parent and Child, where Parent contains a vector that is used to store instances of Child. When I create an instance of Parent, three instan...
[3 replies] Last: Huh? From the above-referenced web page: Inserts a new element at t... (by doug4)
Use fgets and strlen to calculate the length of a txetstring
 
#include<stdlib.h> #include<stdio.h> #include <string.h> int main() { char input ; char buffer ; int length; // gets(buffer); fgets(buffer...
[2 replies] Last: When you use fgets and hit "Enter", a newline charater is included at ... (by LazaroBinda)
Classes that reference classes (1,2)
 
I've split the main part of my program into three classes and their respective functions. I have my 'character' class that deals with the player and the main ch...
[22 replies] Last: That's very helpful. The only problem I can think of at the moment is ... (by shadowmouse)
Binary Search Tree VS Linked List
 
What is the difference between BST and linked list? Or are BST implemented through linked list?
[6 replies] Last: member of bst of what type? type *root? void* root? am getting segm... (by csstudent123)
by paligq
Need help on homework. New to programming.
 
I need to build a program that gets 50 random numbers in an array and sorts them using selection sort. Here is what i have so far. #include <iostream> #inclu...
[3 replies] Last: I did all that stuff and it looks more cleaner and better, but it stil... (by paligq)
print my .dat and keep the previous information
 
i have wrote my code which ask for weight and height but every time i enter my information which will replace the previous information from my .dat file I want ...
[no replies]
I am having a problem solving this. I dont know what i am doing wrong
 
Im trying to do this function and i dont know why it isnt running. #include <iostream> #include <fstream> using namespace std; float findavg(); int findtrunc...
[2 replies] Last: Life saver. Thanks. (by bandosj15)
Matrix Navigation via Pointer
 
Hey there, I want to navigate a 2D Matrix (for example: int iMatrix ), with a pointer. I'm not sure how to traverse this matrix in both demensions with a s...
[4 replies] Last: I'll share the code block I came up with, using segments from the link... (by SixTsevN)
by yo2xia
how do I eliminate a specific column of a matrix using Eigen in C++
 
Apologize if this question is naive. I want to eliminate i-th column of Matrix X, so I use Xnew=X.leftCols(i-1),X.rightCols(i+1); is there some simple way to...
[no replies]
how to ?
 
hey guys im studying about recursion by myself and i want to make a recursive function that prompts the user to input the base and exponent and generate the fin...
[4 replies] Last: Yes, but it's only because that is a function returning int. If you wi... (by LazaroBinda)
October 2014 Pages: 123... 38
  Archived months: [sep2014] [nov2014]

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