- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Hi! I am not too expert in C++ programming. I created a class (Pig), then I created an object (Jack the Pig). In the function Kill, I call the destructor, but it doesnt't "kill" (destroy) my Jack the Pig, because in the next line, I can feed him. So my … |
|
Re:
Hello, I've been in the process of teaching myself C++, going through different tutorials and like. Anyway I was working on a fibonacci sequence program - I looked through the practice problems here and decided to do them all from beginner on upward. I thought I had it working only … |
|
Hi! I'd like to create a simple table game by Swing. I have a JFrame and a JPanel variable. I want to add JButtons to this JPanel, but I'd like to create an own class. I made a class that extends JButton (inheritence): public class GameField extends JButton {...} So … |
|
I give the value of three reference types (Integer,String,List) to a function to change it. But only the value of List changed, but Integer and String are reference types too. Why can't I change their values too? public static void main(String[] args) { Integer i = new Integer(1); String s … |
|
Hi! Which way is the more effective? Is there any difference? If I give value to a variable in the class public class A{ int a = 3; } or if I give value to a variable in the constructor of the class public class A{ int a; public A(){a=3;} … |
|
I have a class (Point2D), and an instance variable (double tav) in this class. I would like to compare different Point2D objects (based on variable "tav") by the relational operators (<,>). (a < b) means that (a.tav < b.tav). Is there any way to solve this problem? public class Point2D … |
|
Re:
can you help me on how to convert the numbers into words . here is my example on how to do that program but im not sure if this is a correct program.. #<iostream.h> #<conio.h> int ones,tens,hundreds main() { cout<<"ENTER NUMBER"; cin>>number; cout<<"ENTER ONES"; cin>>ONES; if(number==1); cout<<"one"; else if(number==2); cout<<"two"; … |
|
Hi! I created an object (Jack the Pig) in the dynamic memory (heap). Because it is a pointer, I can erase it by delete. So I deleted Jack the Pig, but it is not deleted, because Jack->Row function still is working (writes out Rooooow). Why can Jack->Row function still work, … |
|
Re:
Hi i saw a post about this program already. im new to c++ and im lost... completely lost... im not even sure im posting this in the right place. anyways. the program i got is working correctly until i make it an OOP which is what my teacher wants us … |
|
Re:
i am trying to write a program to play the Battleship game;It is not a homework problem just a practice problem. The instructions are: set up a coordinate grid, select your own ships and locations while the computer selects its own; launch missiles by entering coordinates and accept hits from … |
|
Re:
The program below crashes anytime I run it, can anyone tell what I have done wrong?. [CODE] #include <iostream> #include <cstring> using namespace std; class Human { private: char *fname; char *srname; char *phone; public: char * getFirstName(); char * getLastName(); char * getPhone(); Human(char *fn, char *sn, char *ph); … |
|
Re:
Program is suppose to convert binary to hex.. it says that i need a class/struct/union to the left of ".substr" but im pretty sure convert should be working.. [CODE]#include <iostream> #include <string> using namespace std; int main () { string convert [8]; string bin[16]= {"0000", "0001","0010","0011","0100","0101","0110","0111","1000","1001","1010","1011","1100","1101","1110","1111"}; string hex[16]= { "0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}; … |