Beginners - May 2011 (Page 46)

battleship help
 
So I'm making a battleship program and I'm having a little trouble trying to figure out the attack sequence. I thought i had it down but when I tried to compile...
[4 replies] Last: Hey thanks that worked. But what was it that you did? just declared th... (by smr0930)
Namespaces, go figure...
 
So I am reading a c++ book, and this exercise shows up to question my knowledge about namespaces: What is the output produced by the following program? #in...
[5 replies] Last: ooooh, thanks a lot coder777, this namespace thing is confusing withou... (by ProbePLayer)
Okay, now I have no output. Parsing help!
 
I need to take an input file that contains name listed like: John Henry Mary Baker and create an output that looks like: Baker, Mary. Henry, John. Right n...
[6 replies] Last: Yes, I just emailed my instructor and he said the same thing. Actually... (by andimiami)
by mishoo
Inheritance question
 
I used to be good in these but for anymore. I have following code: class A { public: A(){} void show(){ cout << test << endl; } };...
[2 replies] Last: #include <iostream> using namespace std; class A { public: ... (by hamsterman)
How to display length/width of binary tree (1,2)
 
//keith lin, this is one of the original keith program since it's very few. April 29 2011 project 5_2 #include<iostream> #include<cstring> using namespa...
[22 replies] Last: Yes, that's the problem. I did not declare any pointer, the only point... (by jimmy5023)
by firix
substring for both reading and writing
 
Hi, I want to define a substring that can be used for both reading and writing but I am not complete code. template<class Ch> class Basic_Substring{ ...
[no replies]
default constructor help
 
making a class, don't know how to make the default constructor #include <iostream> using namespace std; class School, 3 member variables that are private...
[5 replies] Last: A better way would be with initialization list: [code firstline=16]Sch... (by Bazzy)
recursive function
 
i have this code this code checks the string t in string s and tells that string t contained in string s or not and if not then i have to remove the first chara...
[4 replies] Last: done thanks hamsterman(2185) it works now i am able to submit my assig... (by AliRiaz)
by mora78
Euler method for ODE in c++
 
Hi Everybody I am beginner in c++ and I need your help plz. I implemented euler method for solving simple ODEs (y' = x -y, y(0)=1)and it is forward in time(fro...
[no replies]
Unable to open file
 
Hi there, I'm having issues opening an input file stream and was hoping someone had some insight as to where I'm going wrong. The goal of this program is to ...
[2 replies] Last: I cannot believe I didn't see that. Thank you. I'll give it a try an... (by abrumit)
by caneta
Fill a polygon
 
Hi everyone. I have an array of pixels which can be black or white (values 0 or 1). This array represent an image with a very complex polygon border (the whit...
[2 replies] Last: I don't know how to recognise the corners of the polygon Check the n... (by ne555)
Problem with increment operator
 
I have two classes. In the first I create a node with left right pointers, a templated data member (<T> data;) and a int count;. In my binary search tree cl...
[3 replies] Last: Thanks for the pointer information! That was the problem! I had the ... (by zantocon)
Frustrating "redefinition" error
 
I have a simple header file and a cpp file. In the header I am declaring a class, and in the cpp file, defining it. Here is the header file (RuntimeExcept...
[6 replies] Last: With the fix I detailed above, the two compile without error or warnin... (by Moschops)
Mixed loops?!
 
Ive been messing around with loops lately and I noticed how strangely for loops behave in a while loop. void ForLoop1() { for(int i = 0; i < 100; i++...
[3 replies] Last: Doesn't int i = 0; "initialize" it? It does. But line 2/7 doesn't. ... (by coder777)
Error C3861 issues
 
Hi guys, I'm relatively new to C++ and I'm in the process of putting together a physics engine for one of my courses at school. I'm having problems with the C...
[3 replies] Last: It has. Thanks for the quick response, Xander. (by bensdixon)
Hi Template Questions
 
I have a template question about my program.I put my question in the code. void Interface::unsorted_interger_list() { bool isQuit = false; whil...
[4 replies] Last: Is the normal rule that functions implemented inside the class declara... (by anonymous23323124)
Filling a string array with lines from a text file
 
I'm making a small educational program for my university course and I have a text file that goes like this: What is the function of a binary Adder? What ...
[1 reply] : Doing this with STL it goes like this: std::ifstream is(...); // nee... (by coder777)
Elements of a String
 
I'm trying to declare specific elements of a string and failing horribly. #include <iostream> #include <string> using namespace std; int main () { ...
[9 replies] Last: You're welcome :) (by GodPyro)
Converting ints and doubles and floats.
 
#include <iostream> using namespace std; template <class T> T funnyfunc(T val1, T val2, T val3); template <class T> T Harmonic(T val1, T val2, T val3)...
[5 replies] Last: The idea of 'runprogram' is that you put the whole program in it (or m... (by Disch)
What does '\0' mean here?
 
int main(void) { char cAlphabet = {'I',' ', 'k','n','o','w',' ','a','l','l',' ','a','b','o','u','t',' ','p','r','o','g','r','a','m','i','n','g','!','\0'};...
[2 replies] Last: its quite useful if you want to iterate through each character of a st... (by ascii)
May 2011 Pages: 1... 4445464748
  Archived months: [apr2011] [jun2011]

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