• Member Avatar for Banfa
    Banfa

    Began Watching Im almost there but need a little help!

    > 1) I need to make the game ask the player if they would like to play again and repeat if they choose yes. I have tried to add a …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Im almost there but need a little help!

    Youve missed to top of your code 1. The easiest way to put a repeat into a game once it is already working is to move the whole game into …
  • Member Avatar for Banfa
    Banfa

    Began Watching inheritance and copy constructor

    Hello I write down a bank program and I have a problem. I would be happy if you can help me. So I have two types of accounts each account …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in inheritance and copy constructor

    Your method, BankAccount::NewBankAccount seems to be strangely named and you haven't included the code for it. I would more normally expect to see this sort of polymorpic behaviour implemented through …
  • Member Avatar for Banfa
    Banfa

    Began Watching Simple Ceasar Cipher

    I'm working on a simple Ceasar Cipher encryption program in C. I am trying to make it simpler for my son and I to decipher so I put these rules: …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Simple Ceasar Cipher

    In both cases you have the following problems 1. `scanf("%d ", &shift);` the space after the %d is superfluous and could cause issues, remove it. 2. scanf will likely leave …
  • Member Avatar for Banfa
    Banfa

    Began Watching i made a new cprogram , why i can compile the program ?

    #include <stdio.h> #include <stdlib.h> void main() { int salaryIn = 0.0; int years = 3; float salaryOut = 0.0; printf ("\nWhat is your salary (0 to stop)? RM" ,salaryIn) ; …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in i made a new cprogram , why i can compile the program ?

    "Why i can compile the program ?" this is a strange question, you can compile the program because you have a computer with a compiler on it ??? I suggest …
  • Member Avatar for Banfa
    Banfa

    Began Watching any suggestion that i simple this program ?

    #include <stdio.h> int main() { char membershiptype; int purchase; //float monthly_reward; // enter membership type; printf("membership type: "); scanf("%c", &membershiptype); printf("Standard = S , Plus = P , Premium = …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in any suggestion that i simple this program ?

    You could simplify this by only putting the calculation of the monthly reward in the switch statement, i.e. double reward; /* printf/scanf statements to get membership and monthly purchase */ …
  • Member Avatar for Banfa
    Banfa

    Began Watching Why does strtok delete characters in between delimeters

    So I'm trying to remove 2 brackets from lines I'm reading from a file. For some reason when I run my program the characters in between the delimeters is removed. …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Why does strtok delete characters in between delimeters

    Remember that strtok (which frankly I would avoid using if possible) works by overwriting the delimiters with '\0', it is not deleting anything. It returns pointers into the original string. …
  • Member Avatar for Banfa
    Banfa

    Began Watching Error C++

    I GET ILLEGAL CHARACTER ''(0*1) WHEN COMPLING MY PROGRAM IN BORLAND C++ 5.02
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Error C++

    Firstly there is no need to use capitals that is generally consider rude as it is normally taken to equate to shouting. Posting the code will make easier for us …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Assigning a byearray to a void pointer

    > What will or won't be copied is entirely determined by what operator = does, not by whether or not the implementation of array uses pointers. Yes I agree with …
  • Member Avatar for Banfa
    Banfa

    Began Watching Doubly linked list and polymorphism

    Hi. I'm learning C++ by myself, so I'm a noob, also i'm a mad scientist :P I'm trying to use a doubly linked list with polymorphism, and got a problem. …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Doubly linked list and polymorphism

    Line 171 is redundent, it repeats line 168. The problem is line 169 temp->previous = new_node->previous; You are inserting the new node after temp so `temp->previous` should not change. `new_node` …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Assigning a byearray to a void pointer

    > That completely depends on what operator = does. If the OP's array class acts at all like a standard container class, assigning one array to another should make the …
  • Member Avatar for Banfa
    Banfa

    Began Watching Assigning a byearray to a void pointer

    void func(void * ptr) { bytearray temp(10); *((bytearray*) ptr ) = temp; } This code is not going ahead if the third line while executing while this coding is working …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Assigning a byearray to a void pointer

    It rather depends on what the function is supposed to do, the function you have written assumes that the calling code has cast a bytearray to a void pointer to …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Create 2 constructors

    That is your choice but it seems fairly general, I would just make it a whole separate class.
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in fscanf vs fgets with sscanf

    The problem stems from the %c format specifier which reads a character and since newline is a character it can be read by %c. All other format specifiers, %s, %d …
  • Member Avatar for Banfa
    Banfa

    Began Watching problem compiling timer in sun workshop c++

    Am trying to compile the following code in solaris 7 using sun workshop 5 below but I keep getting the following errors and have no idea how to fix it. …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in problem compiling timer in sun workshop c++

    Looks like you are compiling very old legancy c code and like you are using a c compiler. C does not support function overloading so basically this error is saying …
  • Member Avatar for Banfa
    Banfa

    Began Watching C++ Linked Lists Sorting

    I have write this program,how to sort the numbers? // ddd.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<iostream> using namespace std; struct nodeType { …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in C++ Linked Lists Sorting

    There are all sorts of algorithms you can use, the problem with sorting a singley linked list is in removing an item from the centre of the list requires that …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Create 2 constructors

    You probably forgot the definition of Person, or forgot to include the Person.h header file.
  • Member Avatar for Banfa
    Banfa

    Began Watching fscanf vs fgets with sscanf

    I started off reading a file with fscanf. I figured I could use fscanf since the file was consistent with just two columns. I got very strange output when using …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in fscanf vs fgets with sscanf

    This is because fgets effective consumes the newline for you and fscanf doesn't I assume your file is R XXXX R DISNEY Remember at the end of each line is …
  • Member Avatar for Banfa
    Banfa

    Began Watching Create 2 constructors

    //Hi i do the delivery company project,this are my members of the base class //how do i create 2 constructors in base,one for sender and one for recipient? //I did …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Create 2 constructors

    I think that rather begs the question why would you want to create a package that either doesn't have a sender or doesn't have a receiver? Almost by definition a …
  • Member Avatar for Banfa
    Banfa

    Began Watching Wrapper Classes

    Hi. I'm trying to implement uniform interfaces for two breakout boards (adafruit's fona and sparkfun's Si4703 breakout) and I'm not sure how to go about writing wrapper classes. Can someone …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Wrapper Classes

    Wrapper classes don't have to encapsulate another class, they can for instance encapsulte a legacy C interface or in your case a propriatory interface to some board. If you are …
  • Member Avatar for Banfa
    Banfa

    Began Watching overloading in C++ with vectors

    Problem1: Write the definition for a class named Vector2D that stores information about a two-dimensional vector. The class should have methods to get and set the x component and the …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in overloading in C++ with vectors

    For the main to work you would have to change the output lines to cout << v1 <<" * "<< v2<< " = " << dot(v1, v2) << endl; All …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in coding

    It is iterative because you can make as many exchanges as you like so for example starting with 1 9000g block you swap for 4500g, 3000g and 2250g blocks but …
  • Member Avatar for Banfa
    Banfa

    Gave Reputation to necrovore in coding

    Check this [Code Chef](http://www.codechef.com/problems/COINS) link. Its the same program. Many solutions are given.
  • Member Avatar for Banfa
    Banfa

    Began Watching coding

    You have a block of platinum that can be exchanged in your bank either for cash or for smaller blocks of platinum. If you exchange a block of m grams, …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in coding

    > If you exchange a block of m grams, you get three blocks of weight m/2, m/3 and m/4 grams each. Is the important part of this question because 1/2 …
  • Member Avatar for Banfa
    Banfa

    Began Watching looking for some help with underclared code thanks.

    Am trying to build xinetd on my solaris system am using sun workshop c++/c to compile the code but I keep getting the following errors error: `sys_nerr` underclared (first use …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in looking for some help with underclared code thanks.

    At line 19 and 20 you are using the symbols `sys_nerr` and `sys_errlist` but this is the first time the compiler has seen them, you have not previously declared them …
  • Member Avatar for Banfa
    Banfa

    Began Watching Find the first element in list. C++

    this is my program for list implementation in C++. And I want to print the first element in it. I write element until I reach 0 Can You show me …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Find the first element in list. C++

    Your while loop, lines 17 - 26 puts your list together in reverse order, so the first numbered entered appears at the end of the list and the last number …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Recursion power

    > The way you've approached the algorithm is flawed. It is doubling the result each time, instead of multiplying it by the base number. That's not quite true, the line …
  • Member Avatar for Banfa
    Banfa

    Began Watching Adding forward and back buttons inside a layout

    I have a horizontal layout inside which i have added a group box. The group box is split using a QSplitter and contain a QListWidget and a QTextBrowser. I want …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Adding forward and back buttons inside a layout

    At line 24 remove the `this` because that makes the current class (window/widget) the parent but line 36 tries to make the `_verticalLayout` the parent too and causes the warning …
  • Member Avatar for Banfa
    Banfa

    Began Watching Need help with this program..Binaray Tree Class

    prog6.h #include "340.h" #include "binTree.h" #ifndef H_PROG6 #define H_PROG6 const vector < int > A{ 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15 …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Need help with this program..Binaray Tree Class

    Actually your code compiles fine, but it fails to link because in binTree.h you declare all the functions in the template class binTree but you don't define any of them. …
  • Member Avatar for Banfa
    Banfa

    Began Watching Recursion power

    //Hi,i need to create programm,which takes the user input,determins how many digits in integer // and than raise this digit to power,what was entered by user too. //first function noraml,second …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Recursion power

    Your condition at line 45 `if(exp >= 10)` is wrong. Remeber that any number raise to the power of 0 is 1 but this is not what is embodied by …

The End.