- 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
12 Posted Topics
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: int can be used from –2,147,483,648 to 2,147,483,647. Use instead of int double! void fibonacci(int loop){ double one = 0; double two = 1; for(double i = 0; i < loop; i++) { if(i == 0) { cout << i << ": " << i << "n"; } if(i == … | |
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: in the line 53: if(num/1>=1 && x<10) | |
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: [CODE] // Menu Chooser.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <string> #include<iostream> using namespace std; class MenuChooser { public: MenuChooser() { cout << "Difficulty Levels\n\n"; cout << "1 - Easy\n"; cout << "2 - Normal\n"; cout << "3 - Hard\n\n"; enum level {easy … | |
Re: And in the destructor: [CODE]Human::~Human() { fname = 0; delete fname; srname = 0; delete srname; phone = 0; delete phone; cout<<"Destructor called."<<endl; }[/CODE] It is more secure to set the pointers to null. | |
Re: I think you should use: convert[0]= binfinal.substr (0,4); Because you want to cut the binfinal string, not the convert. Before it, you have to ask for the input. |
The End.