Beginners - March 2012

conversion issues
 
i am making a battle ship program for my class, the teacher wants me to use a 2d array to replicate a one player battleship game. i have having trouble converti...
[no replies]
Initializing a character array
 
I have a class with a member variable: char * name. I would like the program to ask for a name, and then create the array based upon the entry. Right now I ha...
[1 reply] : Our teacher explains they are faster than strings I expect they are... (by Moschops)
Why does this version of the 'swap ints' program work?
 
Why does this program work?/ #include <iostream> using namespace std; void swap(int &a, int &b) { int temp = a; a = b; b = temp; } ...
[2 replies] Last: Thanks I understand it better! I don't know if someone would want to ... (by dmanniteaux)
how to sort a linked list using selection sort
 
#include <iostream> #include <string> #include "Employee.h"; #include "EmployeeList.h"; using namespace std; void main() { EmployeeList a; ...
[no replies]
Cannot find error in program
 
I am new to C++ and was debugging the program below. I believe the error is in the if statements when finding the lowest sales data, but I can't seem to get it ...
[5 replies] Last: I never meant to say you were wrong. I said that when i tried to code ... (by meurtre)
by GulHK
print chars as the keys are hit
 
Hello everyone. I found this method TCHAR win_getch() (below) on a website which is used for printing the characters as the keys on keyboard are hit i-e wit...
[5 replies] Last: ok Thanks (by GulHK)
deleted topic
 
.
[2 replies] Last: Undeleted! Hi, I some trouble with the syntax for passing a member o... (by Moschops)
by Skyza
What is wrong with my C++ program?
 
This is my assignment: Write a menu-driven program that will allow the user to select 1 item from Chuckie's Kitchen Hot Sandwiches, 1 additional side order...
[14 replies] Last: Maybe you want to try it like this: string main; string side; string... (by frema)
Input from file.
 
Hey guys I have been working on this for a while now and I decided I needed help. I can't figure this out. What I want to do is get this grid of numbers: 0...
[4 replies] Last: Thanks man ill look it over. (by closed account G854izwU)
Pointer question
 
I have a struct for a linked list, if I declare it like this struct node { const char *snake; node *tail; }*p; am i right that p is now a p...
[5 replies] Last: ok I think I understand now. So with the first pointer: struct node... (by doddolfur)
Problem using pointers
 
I have a small issue with my code. My instructor provided the main and we are to write the functions. I have most of my code functional, but he has thrown me ...
[2 replies] Last: Thanks so much for your help. I made the corrections and it works per... (by apeachaday)
by vsk23
Map of Vectors of strings
 
Hi, I am new to this forum and to c++. I am writing a program that will create a map of vectors with each key of the map referencing a vector of strings. ...
[no replies]
by hay123
Loop + Random numbers = help needed for a beginner!
 
This is all the info given to me in the directions of the book: How this program works: If a circle of radius r is inscribed inside a square with side l...
[1 reply] : You have some nice equations, but you don't have anything that drives ... (by Stewbond)
question about functions and switch in c++
 
;;;
[3 replies] Last: Yes, use nested switches. (by frema)
Static scope in Class
 
This is what i understood from reading a book, i made this example, it is not working. I understood that declaring a static scope variable in a class makes that...
[3 replies] Last: thanks defining the member did it (by Cristi Stefan)
Only first character of node name parsed. (RapidXML)
 
Hello, I think I'm doing something wrong here: using namespace rapidxml; std::string input_xml; std::string line; std::ifstream in("testtable.xml"...
[no replies]
finding 2nd largest number from 5 given numbers
 
write a C++ program to find the 2nd largest no. from given 5 numbers
[4 replies] Last: I can suggest the following algorithm #include <iostream> int main... (by vlad from moscow)
Beginner question help !
 
#include <iostream> #include <string> #include <cstdlib> using namespace std; int main() { int a=0,b=0,c=0,d=0,e=0,f=0,ana=0,ste=0; string j,k,l,m,n,o...
[2 replies] Last: There is no operator % in the string-library. So what will string%int... (by frema)
Movement Maths
 
How do I accurately move a particle to the centre (0, 0). My current method is void Particle::Move() { double distance = sqrt((x * x) + (y * y)); doubl...
[3 replies] Last: thanks Kyon and Stewbond, you were right, I just needed to swap the y ... (by closed account 2NywAqkS)
Need help splitting a program into functions
 
#include <iostream> using namespace std; int main () { const int size = 50; double temp = {0}; double sum = 0; double avg, high; ...
[4 replies] Last: Thank you, both. This was very helpful :) (by mmc5311)
March 2012 Pages: 123... 71
  Archived months: [feb2012] [apr2012]

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