Beginners - October 2009 (Page 7)

by Gabi
nested class in template class
 
Hi, Can somebody help me, that what's the problame with that code? template <typename T> class A { class B {}; B f(void); }; templa...
[4 replies] Last: I found the answer, it should be: template<typename T> class A {... (by Gabi)
Stuck somewhere
 
Greetings everyone, I'm a novice to C++, just started working with it a couple of days ago. I wrote a program that computes the sum of all integers between 1 a...
[3 replies] Last: There are no and/or keywords in c++. There are http://en.wikipedia.or... (by Bazzy)
by ztein
Using loop to count number of entries
 
I'm writing a program that must ask user to type in numbers. After each entry, the program has to report the cumulative sum of the entries to date. The program ...
[4 replies] Last: Yeh it worked. Thanks. The code: #include <iostream> #include ... (by ztein)
About the return value
 
Hi everyone! i am a totally newb in computer programming. I had tried to run the c++ code below. After i run it, it showed that the y is 5 after the 1st time...
[3 replies] Last: y starts as 5. Then you do y = add_two(y). Inside the add_two( i... (by lace28)
function with array
 
So i need write program,but i don't know exactly how.. User inputs string of integers.If there is not odd number after which is even number i have print out ...
[2 replies] Last: If all are odd,i have to print out only negative numbers That is the ... (by murmuls404)
reading in from file into constructor
 
Ok I have a .txt that i need to read in. Each line of the .txt is formatted like 1 1 0 2 5 9 3 1 5 4 2 6 2 1 ...
[5 replies] Last: :) I thought the ifstream musn't be used during of execution of constr... (by screw)
by rej3kt
very simple do/while statement
 
I'm trying to make a program where people enter how many lines they want and the loop will print that many, what I have so far is: #include <iostream.h> #inclu...
[10 replies] Last: And using system is a very bad practice. Most of what you most likely ... (by closed account S6k9GNh0)
My programm isn't working - Can somebody provide me a solution ?
 
My programm isn't working although it complied o.k I want to calculate taxes for annual salary. programm code is as follows: #include <math.h> #include <s...
[8 replies] Last: The OP code looks C (by Bazzy)
How to store a fraction in reduce form
 
How can I store a fraction in reduce form? For example, I input fraction 2/4, and print out 1/2
[2 replies] Last: My first idea was the string with which you can process. Than I used t... (by screw)
Completely lost. Function program
 
Here is the problem I have: Write a void function called SeasonPrint that take int parameters representing a month and a day and that outputs to cout the name ...
[13 replies] Last: FYI... You have a typo on line 49. (by jsmith)
Adding a single character to a char array?
 
Here is my code: String540 & String540::append(char c){ strncat ((*this).astring, c, 256); return (*this); } I'm trying to add a single character (i...
[2 replies] Last: strncat will work with a single char: char s = "Tes"; char c =... (by jRaskell)
Multiple Module Arrays
 
hello, I can't figure out how to create an array that can be called from any module. Global or public sounds familiar but they don't work. Cheers.
[1 reply] : // foo.h #define MYARRAY_SIZE 12 extern int myarray[ MYARRAY_SIZE... (by Duthomhas)
C to C++ question
 
What is the best way to exactly translate the following C code to C++?: char d; while ((d = fgetc("test.txt")) != EOF) I've tried the following but it ...
[4 replies] Last: Alright I made some progress thx to btripp. My next problem is that I ... (by Nature1)
problem with loop
 
Hey I'm really new to c++ and am currently frustrated and at wits end on how to print a character beside each other instead of below it after asking input from ...
[5 replies] Last: you wouldn't also know how for this program. To use a new variable to ... (by Nut420x)
by btripp
Need a little advice
 
Hey, I am intersted in making useful applications. Im particularly intersted in applications that work with the web. somehow using info from the web and send...
[2 replies] Last: I will have to look into that. I had it downloaded on my laptop. But i... (by btripp)
homework question for functions
 
I have this question to answer: What is wrong with the following function? void power (int x, int y, int result) { result = 1; while (y > 0) { res...
[9 replies] Last: yea i wouldnt use a reference in this case, i just thought it was requ... (by btripp)
why not always hello?
 
/* Name: strdup.cpp Purpose: exercise. */ #include "error.h" #include <cstdlib> using namespace std; //=======================...
[4 replies] Last: The reason I am doing this is to gain an understanding of pointers and... (by closed account iw0XoG1T)
min, max, middle problem.
 
I bombard this site way too much, I'm sorry. But I am stuck, once again. The problem is :Write a program, consisting of two functions:  main function ...
[2 replies] Last: Okay, this is the new code I have now. //Program consisting of thr... (by Joliedoll)
Deleting pointers froms vector?
 
Hi. I have a vector filled with pointers and I want to delete the pointers. I could do a loop and do delete on all indexes, but my question is that if I just cl...
[7 replies] Last: Yes. (Though of course it isn't really possible to put auto_ptrs in a... (by jsmith)
why does it work on windowsXP, but not on linux?
 
on line 59 I pass strdup as a reference, but when I wrote this and compiled it originally on window I did not pass it as a reference. On widows there was no pro...
[3 replies] Last: Thank you--I will correct line 16. (by closed account iw0XoG1T)
October 2009 Pages: 1... 56789... 25
  Archived months: [sep2009] [nov2009]

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