43,549 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for srinath3

[CODE]#include<iostream.h> class invent2 class invent1 { int code; int items; float price; public: invent1(int a,int b,float c) { code=a;items=b;price=c; } void putdata() { cout<<"code:"<<code<<"\n"; cout<<"items:"<<items<<"\n"; cout<<"value:"<<price<<"\n"; } int getcode(){ return code; } int getitems() { return items; } float getprice() { return price; } operator float(){ return(items * code); } …

Software Development c++
Member Avatar for srinath3
0
439
Member Avatar for SmackFN22

I am trying to write a program that will work like a hangman game. I have a loop that assigns the characters to their spot in the string and is supposed to end if the newly assigned string equals the original word. If the letter guessed is correct, nothing should …

Software Development java
Member Avatar for SmackFN22
0
107
Member Avatar for Cort3z

Hi. Im working on a text-based "game" that uses strings to generate maps. So I need to split these strings into bits that i can work with, but somehow the .split method kills the white space in my string. How can I get around this? Of course I can force …

Software Development java
Member Avatar for masijade
0
171
Member Avatar for TheWhite

If I have 2 synchronized methods and 1 calls the other, what exactly happens? If those 2 synchronized methods are in a class, and 2 of those classes are created, each of them calling one of their synchronized methods, what would happen? If those 2 classes extended Thread and were …

Software Development java
Member Avatar for TheWhite
1
166
Member Avatar for jigglymig1

I have to write a program that accepts a pointer to a c-string as its argument. The function should return the charater that appears most frequently in the string along with the number of times it appears. for example, if i input "hello dolly" the output would be: "l sppears …

Software Development c c# c++
Member Avatar for r.stiltskin
0
161
Member Avatar for C+Marshall

here's another one that i've been struggling with. I need to create a phone number that can not have an 8 or a 9 in the area code. I thought it would be smart to simply generate the area code one number at a time .............. num1 = generator.nextInt(7)+ 1; …

Software Development java
Member Avatar for kvass
0
97
Member Avatar for ccie007

Hi frens, I couldn't compile this solution code given by my university on visual studio.Visual studio works fine with other C++ files. Here are the question and solution code pasted below.I wonder if anybody could try to compile the solution code on thier machine and see if they can run …

Software Development c c# c++ visual-studio
Member Avatar for ccie007
0
167
Member Avatar for kfancy

Hi all. Please edit/add/help me make this blackjack program work. Thank you. class Card: def __init__(self, suit, rank): self.rank = rank self.suit = suit if self.rank == 1: self.rank = "Ace" self.value = 11 elif self.rank == 11: self.rank = "Jack" self.value = 10 elif self.rank == 12: self.rank = …

Software Development python
Member Avatar for woooee
0
170
Member Avatar for PDB1982

I have to create a program that handles random birthdays between 2 and 50 students (depending on what the user inputs), and calculates the random birthday (1 to 365) and then determines whether or not students share the sam birthday, and how many students share it. I'm stuck on how …

Software Development c++
Member Avatar for jonsca
0
198
Member Avatar for bharatk

I have opened an image using the PhotoImage method of ImageTk How do I close the image. This is the scenario is I am using it in. I have 2 buttons, one each to open an image from disk & image from url. When I open either of them the …

Software Development image python
Member Avatar for bharatk
0
1K
Member Avatar for Hawkeye Python

I've read the documentation, but I still can't creat my own packages. How should the __init__.py look like? Cause i've tried to let it blank and some stuff like [CODE] my_package/ __init.py__ sub_pack/ __init.py__ test.py [/CODE] but it pointed syntax error If I don't write anything on it, no error …

Software Development python
Member Avatar for Ene Uran
0
96
Member Avatar for blerina12

Hello guys. I am working on the code below. I am trying to create my own shell. The code compiles without errors, but when I execute it though it doesn't output anything. I have tried it with /bin/ls as input and it doesn't work. Any suggestions? [code=c]#include <stdio.h> #include <stdlib.h> …

Software Development c
Member Avatar for blerina12
0
1K
Member Avatar for wolfkrug

I am writing a game program for a dice game. You want to get 100 points. You roll until you decide to hold, and the sum of your rolls is added to your total score. If you roll a 1 though, your turn is over and you get 0 points …

Software Development c++
Member Avatar for tetron
0
164
Member Avatar for kfancy

import random class Card: def __init__(self, suit, rank): self.rank = rank self.suit = suit if self.rank == 1: self.rank = "Ace" self.value = 11 elif self.rank == 11: self.rank = "Jack" self.value = 10 elif self.rank == 12: self.rank = "Queen" self.value = 10 elif self.rank == 13: self.rank = …

Software Development python
Member Avatar for redyugi
0
178
Member Avatar for txwooley

How would I execute a command and have it's output returned as a list or string? For example (in Linux): [CODE]os.system("iwconfig")[/CODE] prints a list of wireless devices to stdout. How can I make Python see those results as a list or string so I can search for certain devices (like …

Software Development python
Member Avatar for txwooley
0
110
Member Avatar for Suicidal_tool

Appretiate some coursework help related to classes. All im trying to do is compare the elements of two objects [code] if(asteroid1.getxx == asteroid2.getxx && asteroid1.getyy == asteroid2.getyy) { cout<<endl; cout<<"Collision"<<endl; } [/code] All i want to be able to do, is to compare the x and y co-ordinates of my …

Software Development c++
Member Avatar for Suicidal_tool
0
97
Member Avatar for horseygal

Hi, can anyone look at this and see why it doesn't work? When I test and enter a numeric value in the text box it still gives the error I have placed in the code, same if I put in a letter etc. Thanks!! :) [CODE]Private Sub valueDouble(ByVal sender As …

Software Development vb.net
Member Avatar for horseygal
0
140
Member Avatar for Stefano Mtangoo

Hi, I have used a lot of makefiles to compile programs. The issue is, I don't know how to produce make file. Is it another "language" I have to learn or some automatic issue? Also what is short yet clea tutorial on that? Thanks

Software Development c++
Member Avatar for jonsca
0
98
Member Avatar for Jiwe

Hello everybody, I'm trying to get the user name using GetUserName() API function, it was sucessful in the console project however in the Visual C++ project it gives me this error: [CODE] 1>MyProgram.obj : error LNK2028: unresolved token (0A00000F) "extern "C" int __stdcall GetUserNameA(char *,unsigned long *)" (?GetUserNameA@@$$J18YGHPADPAK@Z) referenced in …

Software Development api c++
Member Avatar for Jiwe
0
3K
Member Avatar for stryker4526

So I'm working on a quiz game application, and one of the things I have to do is use StreamReader to read questions from a text file of the format [quote]Question Answer1 ###Answer 2 (correct answer denoted by ###) Answer3 Answer4 Question2 Answer1 Answer2 ###Answer3 Answer4[/quote] and so on. I …

Software Development
Member Avatar for jonsca
0
111
Member Avatar for sleepybug

hey!i was tryinn to write this complex number addition and i dunno where this garbage value it is pickin from :-/.... m gettin mad over this because first time such a simple program has got me all over :icon_mad:.... so here's the code: # include <iostream> using namespace std; # …

Software Development c++
Member Avatar for jonsca
0
108
Member Avatar for rehber344

hi this is the corotuıne example writen in def [CODE]namelst=['Charles Darwin (1809-82)', "Darwin's principal works, The Origin of Species (1859)", 'and The Descent of Man (1871) marked a new epoch in our', 'understanding of our world and ourselves. His ideas', "were shaped by the Beagle's voyage around the world in", …

Software Development python
Member Avatar for vegaseat
0
117
Member Avatar for AnnetteM

Has anyone used this code to calculate quantiles? The code defines the function 'quantile'. If one runs the code and names the script file 'quanitle.py' and puts it in the same directory as another code file calling the function, why is the function not accessed???? Here's the copy-and-paste script for …

Software Development python wordpress
Member Avatar for AnnetteM
0
274
Member Avatar for rlogan1

Hi, does any of you have any idea why the self.status variable is not rewritten? When I run the script below, although it connects to the ip and port mentioned, and receives a message, the self.status is still "down" the otuput is : 192.168.0.1 down it should be: 192.168.0.1 'message …

Software Development debian python
Member Avatar for rlogan1
0
97
Member Avatar for akamini

Yet another date time related sql statement i need help with, oh how I loathe them. I need to find the records between now and a week ahead. I have this so far [CODE] Dim con As New OleDb.OleDbConnection Dim OleDBCon As System.Data.OleDb.OleDbConnection Dim ds As New DataSet Dim da …

Software Development dataset open-source sql vb.net
Member Avatar for akamini
0
133
Member Avatar for Kruptein

I really don't see what is wrong =(. First I download via curl a file, then I want to compare it to a local file there are 15 lines in dwnext.ded and there are 14 lines in extlib.ded I want to store in append those lines that have a string …

Software Development os-x python
Member Avatar for Kruptein
0
176
Member Avatar for Raged

Hey all I'm having loads of problems trying to update my database with a dataset, I have been looking around forums and posts and trying all sorts of work around's, as far as I can assume, I will need to manually create (insert, update) function querys (even though as far …

Software Development dataset open-source vb.net
Member Avatar for Raged
0
195
Member Avatar for dre-logics

I Use visual Basic 8.0 and Mysql 5.0 I have one Table1: [COLOR="Red"]Table1[/COLOR]: RecordID , Integer = primary key auto_increment NOT NULL Articlenr , Integer Articlename, Char(20) Table1: has two records: RecordID, Articlenr ,Articlename 1 , 1000, Hamer 2 , 2000, saw I want to use Datagridview to update Mysql …

Software Development dataset mysql vb.net visual-basic
Member Avatar for dre-logics
0
3K
Member Avatar for wilsonz91

Hi, I recently bought a book-The Complete Reference C++ by Herbert Schildt. The first part explains about the similarities about C++ and C. The syntax used is different from the one my lecturer is teaching. eg: cout<< is replaced by printf cin>> is replaced by scanf I would like to …

Software Development c c# c++
Member Avatar for wilsonz91
1
201
Member Avatar for Stefano Mtangoo

Is this possible? Any tutorial if possible? I want to make a program to do mass conversion of my Icons without loosing resolution

Software Development python
Member Avatar for Stefano Mtangoo
0
850
Member Avatar for mswezey

Hello this is for my assignment for college. I just need help on how to properly declare ofstream/ifstream globally to get my program to work the proper way. Yes I know I can just declare it in Main() and use pass by reference. ( Did that on the first project …

Software Development c++
Member Avatar for mswezey
0
3K
Member Avatar for bbabarajj

How to add 1/1+ 1/2+1/3...+1/9+1/10 . I tried but I am getting answer in negative number.

Software Development c c# c++
Member Avatar for bbabarajj
0
2K
Member Avatar for Metraton

Hello guys! I'm facing a problem with IO using files. Here is the simple code that's kepping me awake: [code]Files::Files() { numbers.open("textfile.txt"); if ( numbers.good() ) { cout << "Object from Files class ok!" << endl; } else { cout << "Object from Files class NOT ok!" << endl; } …

Software Development c++ file-system ios visual-studio
Member Avatar for jonsca
-1
79
Member Avatar for horseygal

Hi everyone, I am working on a window that will calculate an average grade from 3 grades typed in by user then display it's appropriate grade letter. This is what I have so far and well it isn't working. Can anyone point me into the right direction as to what …

Software Development visual-basic
Member Avatar for SCBWV
0
110
Member Avatar for Dewey1040

I wrote a program to compare two text files character by character and its not working probably an easy thing im just not seeing. [code=c++] #include <iostream> #include <fstream> #include <string> using namespace std; int main(int argc, char *argv[]){ string s1; string s2; char c1, c2; if(argc !=3) { // …

Software Development c++ file-system
Member Avatar for WaltP
0
178
Member Avatar for soapyillusion

Hey guys Ive been working on this problem for standard deviation, and so far ive got it all right accept my declaration in this module, was wondering if anyone can help me see whats wrong with my formula or the decelerations i have made Here is the code for my …

Software Development c++
Member Avatar for dusktreader
0
165
Member Avatar for Hawkeye Python

I'm new at Python coding and in DaniWeb. Really nice forum :icon_cheesygrin: Need some help w/ the following code: the content of saldo.txt is the following [CODE]1000[/CODE] The code I was talkin' about: [CODE] # [...] f = open('C:/saldo.txt') print f saldo = f.readline() f.close() if saldo <= 100: a …

Software Development python
Member Avatar for snippsat
0
120
Member Avatar for binay2

Hello! So , I got a weird problem.In my code the value of the char N[cn] is ignored when I compare it to a constant value. Here's the code: Code: [code] for ( i = 1; i <= 220; i++ ){ // Generate Numbers itoa (i,Number, (V+1)); sscanf(Number, "%d", &ii); …

Software Development c++
Member Avatar for binay2
0
360
Member Avatar for NinjaLink
0
76
Member Avatar for akamini

I was wondering whether anyone could tell em whats wrong with this code. Its trying to get the records where the theorydates (stored in a database as shorttime) are before 2 years ago and return the records in a datagrid but it doesnt. [CODE] Private Sub ExpiredTheoryTest_Load(ByVal sender As System.Object, …

Software Development dataset open-source sql vb.net
Member Avatar for apegram
0
105
Member Avatar for NinjaLink

Hey, this is my first java program. I am trying to print my original list of ages, but I can not figure it out. Please help! I have part b and part c already done. Any help is appreciated a) print original list of ages b) number of occurrences of …

Software Development java
Member Avatar for NinjaLink
0
102
Member Avatar for 3Dees

Hey, i am trying to convert a 2D array to a 1D array and also the reverse. Not sure if i am doing it right so does anyone know how it can be done. below is the code i have for 2D to 1D but now how do i do …

Software Development vb.net
Member Avatar for kvprajapati
0
1K
Member Avatar for Stefano Mtangoo

Hi all, I have been looking for single function to split strings and seems to me either is not available or I miss it. So I please, help me to know if it is available and if yes where can I get it. Thanks

Software Development c++
Member Avatar for jBat
0
96
Member Avatar for abhimanipal

Hi All, Today I came across a peculiar piece of code. [code] int main(int argc, char* argv[]) { printf("%lf\n",(0.99-0.90-0.09)); } [/code] According to me the output for this code should be 0, but to my surprise when I ran this code the answer that I got was -0.000. I cannot …

Software Development c
Member Avatar for abhimanipal
0
99
Member Avatar for Hawkeye Python

Incomplete dice game function, dunno why does'nt works... If you're not using windows, change the dir. "C:/" [CODE] def bet(Bet): try: f = open('C:/money.txt') print f money = f.readline() f.close() print ('You have', money, 'Dollars. Wanna play dice(y/n)?') v = raw_input() if v == 'y': # here i'm printing those …

Software Development python
Member Avatar for The_Kernel
0
175
Member Avatar for Grn Xtrm

Hello. I'm trying to write a program that will convert a user input infix expression into its postfix form. My current code is allowing the user to input a string, but it does nothing with the string. I'm fairly new to JAVA, thus I think I'm making a simple mistake …

Software Development java user-interface
Member Avatar for cymercutie88
0
1K
Member Avatar for Stubaan

Hi folks Can anyone explain to me why this is not working please? I am trying to delete the first 52 lines of a text file, then skip deleting the next line, then deleting the next 100 lines, then skipping the next line and repeating the process until the file …

Software Development python
Member Avatar for Stefano Mtangoo
1
120
Member Avatar for tformed

Hello, I am a new member to this forum. I have some announcements, I will continue to read some more. I need to create a program were the user inputs a number, program displays the cube root for that number. The code I got thusfar is: [CODE][COLOR=#0000ff] #include[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]<stdio.h> [/COLOR][COLOR=#0000ff]#include[/COLOR][COLOR=#000000] …

Software Development c++
Member Avatar for NathanOliver
0
697
Member Avatar for Slacked

Hi, I'm trying to create a pretty basic fancy string output, [CODE] #include <iostream> #include <cstring> #include <stdlib.h> using namespace std; int main() { char output[] = "Hello there world"; int len = strlen(output); for (int i = 0; i < len; i++) { cout << output[i]; system("sleep 0.1"); } …

Software Development c++
Member Avatar for Slacked
0
158
Member Avatar for jangozo

Hello, I'm trying to make my code work with -Wall -Werror flags but I get the above error (error: array subscript has type char). Here is the code, which works if these flags are not set. The code is meant to check whether the first character from text is blank …

Software Development c++
Member Avatar for jangozo
0
420

The End.