Beginners - October 2011 (Page 15)

error in the code
 
if i dont call the displayMessage function everything works fine but if i do call it as in the follwing the compiler gives error " no match for 'operator<<' in...
[1 reply] : "main" should be main() "cout<<gradeBook1.displayMessage();" should be... (by MagicDark)
Find characters in a string
 
Hi all, I already checked http://www.cplusplus.com/reference/string/string/ and didn't find what I'm looking for, but I thought I'd ask anyways: is there any...
[1 reply] : This is very simple to implement yourself. Something like: int fin... (by Moschops)
Keyboard recognition
 
Hello, I am working on a text based adventure game. The problem is how would I go about doing something such as when the player presses the character i would op...
[2 replies] Last: I'd do the same xkcd83 suggests, only with a string instead of a char ... (by Serious Sam)
by codrgi
vector loop?
 
does anyone know the best way to go about starting a loop to search for values in a vector? for example my vector contains 10 values ranging from 1-11, which is...
[3 replies] Last: Note that it is good practice to favour the pre-increment form of the ... (by andywestken)
iterator for a template class containing vector
 
Hi again, I'm trying to implement a specialized form of a list, I do not want to inherit from std::vector (I've read that this is not a good idea, though I d...
[1 reply] : I figured it out. The problem was that when I was creating an instance... (by midurad)
using switch statements
 
So my task was to create a program that calculates the determinant of a 2x2, 3x3, and 4x4 matrix. My first step was to create a library of functions for calcu...
[2 replies] Last: Thanks.. Tried going back and noticed the missing brackets. Now line ... (by rprcmky)
completely stumped
 
Our teacher assigned this problem: 2. Multiplication Teacher: Some elementary school students say that they find computers just as easy to learn from as t...
[2 replies] Last: You really should attempt the code before posting to forums. Figure o... (by TheMeerkat)
by rjcup3
.eof() problem with functions
 
Ok I can get this program to read and work fine when I tested it with just the first line of data, but when I try to get it to loop through the whole file it ju...
[6 replies] Last: If you guys care, I fixed it... here's what I did for posterity: #in... (by rjcup3)
Parsing binary data from file
 
Hello all, and thank you in advance for your help! I am in the process of learning C++. My first project is to write a parser for a binary-file format we use a...
[9 replies] Last: Hi all, I've been following your thread. I am not a great c++ coder, ... (by bennyp)
by lrockm
Arrows ->
 
I've been studying C++ for awhile but i still can't grasp the usage of arrows -> .. how to use it and why ? Thanks for teaching~ appreciate it
[5 replies] Last: Thanks a lot guys, I at least grasp the idea of the usage already :) (by lrockm)
Prime numbers help please
 
I am being asked to generate prime numbers up to an intputted limit from the user. When I input numbers, this program seems to generate number 2 and ODD numbers...
[1 reply] : In the isprimes function, you have the return statement in the for loo... (by xkcd83)
Baby Names
 
I am trying to implement some simple logic into my program but I am apparently not understanding what the problem is. This is the first time I have worked with ...
[5 replies] Last: Ok, I get it now and got it working with the following implementation:... (by Warmaster)
How do I Loop this?
 
double maturityCalc (double invest, float interestR, float years, int compound) { double interestT = 0; double epon = 0; interestT = (1+((interestR/1...
[2 replies] Last: how would i go about using the the "for loop" and "switch construct" ?... (by basedmod)
Tortoise Hare Race
 
Ok so I have a code for the race and it works, but I need to add a finish line to the right hand side of the page when it's printed out. How do I do that? Also ...
[4 replies] Last: For a delay, you could use #include <windows.h> and then call Sleep... (by whitenite1)
Quadratic equation
 
okay what's wrong with this program ? it shows me delta but not more ..i want to see x1,x2 too .. #include <iostream> #include <stdio.h>; #include <math.h>; voi...
[5 replies] Last: How does it show you delta? I don't see an output statement for delta.... (by Michael37)
How can i press a key?
 
Hello, How can i press a key with c++? o.O Something like this? keybd_event(VkKeyScan'F5')0,0,0; I just want to make a console program to refresh t...
[2 replies] Last: Thanks lol ive been searching for "key press c++" and all i got is "ke... (by spongebox)
updating a card deck
 
Hi I was wondering how I would update the sum when a random card is drawn in my program. So far I have a few ideas in mind. int player = 0; int deale...
[1 reply] : Could you explain a little bit more what you want to do ??. Apparently... (by MagicDark)
Can you use a method inside a stream insertion overload?
 
I'm trying to overload << to print some things. Creating a simple print() method works fine like this: // stockTypeImp.cpp implementation file #include <...
[2 replies] Last: Thanks Andy. (by horseatingweeds)
temperature home work
 
>Celsius Temperature Table The formula for converting a temperature from Fahrenheit to Celsius is where F is the Fahrenheit temperature and C is the Celsius t...
[5 replies] Last: The comment about the void main is valid. Celsius() isn't defined with... (by mzimmers)
expected `,' or `;' before "int"
 
Hi I just started c++ a few days ago, and I'm making a distance converter. My code is: #include <cstdlib> #include <iostream> #include <string> using name...
[1 reply] : The error says it all. You are missing a ';', the "before int" signifi... (by Danny Toledo)
October 2011 Pages: 1... 1314151617... 59
  Archived months: [sep2011] [nov2011]

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