Needed a func to convert base 2 into 10, and back. Found the referenced code in this func for moving between three bases, and generalized it to between bases 2 and 62, and all in between. Upconvert a number, then down convert, then upconvert again. Go wild, have fun.

Member Avatar
+0 forum 0

Hey everybody, As of this moment i'm trying to work out how to approach a state design. I've come across Source Makers' site [http://sourcemaking.com/design_patterns/state/cpp/1](http://sourcemaking.com/design_patterns/state/cpp/1) and am testing out the example. The program works fine when it's all in 1 file, although i had to change some stuff in main, but when i separate the program into headers and .cpp errors would occur. This is what i have at the moment. There's quite a lot of errors but i think it all has to do with the "base class not being defined". The majority of errors are defined as... `error C2504: …

Member Avatar
Member Avatar
+0 forum 5

Hi I'm creating a code for my class and what I'm trying to do is to create a triangle class that is derived from abstract class TwoDimShape. However; when I create the triangle class and use base as a variable I get an error. My teacher wants us to use the variable "base" here is my code and the error, any help is appreciated. sing System; public class Triangle : TwoDimShape { private double base; private double height; } and the error is: Error 1 Invalid token 'base' in class, struct, or interface member declaration

Member Avatar
Member Avatar
+0 forum 4

Say I have this definition: #define SIZE 2000 typedef enum { TRUE, FALSE }Boolean; typedef struct{ char jobTitle[30]; char jobDesc[255]; char jobLoc[255]; float salaryMin; float salaryMax; Boolean isAvailable; }jobInfo; typedef struct cursorNode{ jobInfo jobRec; int next; }HeapSpace[SIZE]; typedef struct hnode{ HeapSpace heap; int Avail; }*VHeap; typedef int List; typedef struct{ List availJob; List notAvailJob }dualList; Let's say my function data type would be this: dualList ConvertOld2NewList(VHeap *VH, List *L) { return L; /*not sure about this since I will be converting this single list to a dual list*/ } I was asked to write the code of function ConvertOld2NewList. Given …

Member Avatar
+0 forum 0

Dear there, I am planning to develop database application in c# and SQL. But i face the problem, the problem is HOW TO INTEGRATE DATABASE INTO SOFTWARE DURING CREATION OF SETUP? Any help please!

Member Avatar
+0 forum 0

I'm trying to convert a number from any base between 2-36 to any base between 2-36. I have the conversion to base 10, but I'm having trouble getting it from base 10 to the desired base. Any ideas? I know part of this idea will work, I just can't get it all together syntatically. And don't worry about the checks (user inputs number 13, base 2), I'll add that at the end. Thanks! #include <iostream> using std::cout; using std::cin; using std::endl; int ToTen ( char number[15], int base, int newbase ); void ToNewBase (); int main() { char number[15]; int …

Member Avatar
Member Avatar
+0 forum 4

In java this is how a DerivedClass can implement it's BaseClass's constructor. public DerivedClass extends BaseClass { //some properties public DerivedClass(param) { super(param); } } I have learnt C-Sharp's *base()* does the similar thing, but when I replace *super(param)* with *base(param)*, it does not gives what I'm expecting. How can I implement this code snippet in C#?

Member Avatar
Member Avatar
+0 forum 3

i am making a number base conversion program in c++, suppose that user enters an base 2 number and want to convert that number in base 4. when he enter the number (which he wants to be converted), how can i detect that number is belongs to base 2 number system or not. for example: if user enter 1001011001 , program should continue and convert that number to base 4. and if user enter 1200101 or 1001012 , program should not convert that number and output that this number is not belongs to base 2 number system. waiting for your …

Member Avatar
Member Avatar
+0 forum 6

Write a complete, well-written, documented program (named convert) that prompts for and reads in a number with at most MAX_DIGITS (9) in one of the following four formats: binary, octal, decimal, and hexadecimal and converts it to a requested base. Once the number has been read in, you should verify that the number is valid (more on this later). If it is not valid, you should print the appropriate error message described below and exit with the specified error code immediately. After you determine the input is valid, you should determine what format the number is in (based on the …

Member Avatar
Member Avatar
+0 forum 5

Hello Community, Is there a website that has a database like phpmyadmin that i can access from my website? Please help...

Member Avatar
Member Avatar
+0 forum 6

This is based on advise given ina previous thread I posted awhile ago for protecting data. I tried the following: <?php function base_encode($text) { $size = strlen($text); $str=""; for($i=0;$i<$size;$i++) { $str=$str.slide_left(substr($text,0,1),4); $text=substr($text,-1); } return $str; } function base_decode($text) { $size = strlen($text); $str=""; for($i=0;$i<$size;$i++) { $str=$str.slide_right(substr($text,0,1),4); $text=substr($text,-1); } return $str; } function get_num($i) { $j=0; for($j;(($j<128)&&(chr($j)!=$i));$j++){} return $j; } function slide_left($i,$num) { //$str="-1"; $nn = get_num($i); //if($nn!=-1) //{ //$nn = ($nn+$num)%count($valid_chars); $str = chr(($nn+$num)%count(128)); //$str = $valid_chars[$nn]; //}*/ return $str; } function slide_right($i,$num) { $str="-1"; $nn = get_num($i); $nn-=$num; if($nn<0) { $nn+=count(128); } $str = chr($nn); return $str; } function …

Member Avatar
Member Avatar
+0 forum 1

So there is a problem: I get data from the internet in table form( currency),and i want to get it into the chart form,and after refreshing-it could show the same as real forex trading platforms. And sorry for typing not in right direction, VBA close to /excel..and couldn't find any closest

Member Avatar
Member Avatar
+0 forum 1

Creating a simply data base to store these variavles. The three entities are book, brower and Records. Using these we will create a simple database from dev c++.

Member Avatar
Member Avatar
+0 forum 1

Hello, I want to combine all my database table in to one line so i can put it all in the url e.g. Name | Times __________________________ test1 | 1 __________________________ test2 | 2 __________________________ This is how i want it to look in the url (Result.php?loggedin=true&links=test1-1_newline_test2-2)(_newline_ means that will be a break point when the other page receives is links) NOTE: After the script retreves the data i'm using header('Location: page') to send the data to the result.php page.

Member Avatar
Member Avatar
+0 forum 2

How can I cast a base class to a derived on at runtime. What I am trying to do is the following: I need a system which will hold the subscriptions, where a certain type of message, has an assigned Subscriber. When a message is received, it will bi forwarded to this system, which will do a lookup if there are any subscribers to this kind of message and if so, message is forwarded to subscriber. I have an abstract base class called Response, followed by an abstract layers eg. AFResponse : Response, and then there are the actual (concrete) …

Member Avatar
Member Avatar
+0 forum 1

Hi guys, I am having a problem with the following code: #Health set here def win(): import time print "You win!" print "Thanks for playing" time.sleep(10) quit() def lose(): import time print "You lose!" print "Thanks for playing" time.sleep(10) quit() from random import randint pos_damage = randint(15,472) en_health = 1000 pl_health = 1000 #Define Caves cave_p1 = "This part of the cave seems quite, strange, it is rather dark too." cave_p2 = "There is not much here, quite....blank." cave_p3 = "Rocky area, i'm afraid you might not make it without something" #Use modules import os, random from time import sleep …

Member Avatar
Member Avatar
+0 forum 3

hello ! I'm working on a Registry page for my webSite in ASP and I'm trying to get results of a prcedure from my database which is checking if there is any duplicates of loginNames or emails when there is inserting to Dbase. The problem is I can't finde any functions to get this results in asp.ne/C#t. Have any one such a problem, or knows how to do this ? Thanks for any help.

Member Avatar
Member Avatar
+0 forum 2

I've recently found that 1and1, my host, doesn't allow for remote access to MySQL databases and tables, and access is only possible via a slow and cumbersome web UI. Is there any workaround? I don't want to have to spend ten minutes browsing PHPMyAdmin every time I need to timestamp an article I add to my site.

Member Avatar
Member Avatar
+0 forum 8

Here is my take on [balanced ternary](http://en.wikipedia.org/wiki/Balanced_ternary) conversion (the base considered by [Donald Knuth](http://en.wikipedia.org/wiki/Donald_Knuth) "Maybe the prettiest")

Member Avatar
+1 forum 0

Here is base conversion function written to deal also with [negative bases](http://en.wikipedia.org/wiki/Negative_base). Not yet balanced ternary, where numbers themselves can be negative, maybe later I add it.. Based on the code in the wikipedia article, which has bug for converting 0.[**Edit: I fixed the bug in wikipedia**]

Member Avatar
Member Avatar
+0 forum 2

Dear All, I have written a code to implement an algorithm for base conversion from decimal to any base between 2 and 36 given in RG Dromey. Below is my code and I have a few questions relating to it: [CODE] #include<stdio.h> #include<stdlib.h> int main() { int newbase,zero=atoi(0),q,ndigit=0,r,ascii,i; char newrep[100]; printf("Enter number and base(between 0 and 36) to be converted"); scanf("%d%d",&q,&newbase); while(q!=0) { r=q%newbase; ndigit+=1; ascii=zero+r; if(ascii>atoi(9)) { ascii=ascii+7; } newrep[ndigit]=(char)ascii; q=q/newbase; } for(i=ndigit;i<=1;i++) { printf("%d",newrep[ndigit]); } system("pause"); return 0; } [/CODE] 1. Why is there a need for reverse conversion to characters of the ascii value after conversion before …

Member Avatar
Member Avatar
+0 forum 6

Just want to see if there is a thing to turn oh "Test" to binary/base 2 stuff. This: [CODE]muffins = 12+16%2[/CODE] I think is sortof what I'm looking for but it chops of whatever's bigger than 2.

Member Avatar
+0 forum 0

hi guys iam a student of the department software engineering i have a question about something and i would like to help me on it ... i want to do program that contain all data swift code for the countries in this site [URL="chips.org/uid"]chips.org/uid[/URL] just like the idea on it i know in visual c++ and some in java but tell me in any programming language and which is the easiest because my sister working in a bank and she asked me to do this program for her because in her work their system is down and they have alot …

Member Avatar
Member Avatar
+0 forum 6

Is it possible to find the offset value similar to offsetof() function when i know only the structure name and the address of the member of structure. For ex in offsetof , the structure name and the member name is given to find the offset. Similarly is it possible to find the offset by knowing the structure name and address of the member.

Member Avatar
+0 forum 0

Hi, Im trying to convert my UserControls to be sharable across multiple projects. I have read up on this, and it seems that I need to have all code in one file (i.e. in the .ascx, rather than codebehind/designer) so I am trying to do this: [CODE] <%@ Control Language="C#" AutoEventWireup="true" ClassName="ImageButton" Inherits="Button" %> <%@ Register src="Button.ascx" tagname="Button" tagprefix="MIKE" %> <script runat="server"> protected override void OnInit(EventArgs e) { this.ImageTag.Src = ImageStartPath + "/" + ImgSrc + "_Up.png"; base.OnInit(e); } ... [/CODE] the problem is, that despite the "Inherits" attribute on the <%@ Control tag, set to "Button", which is the …

Member Avatar
Member Avatar
+0 forum 5

IT currently is set up for base 3, but should be able to make a couple of minor changes and convert to any base, thanks and hope it helps someone out. [code]#include <iostream> #include <cmath> #include <fstream> using namespace std; void convert_base(int v, int b); ifstream inputdata; ofstream outputdata; int main(int argc, char *argv[]){ //int a, b, c, d, e, f, i; int v; int base = 3; inputdata.open("Base_Conversion_File.dat"); if(!inputdata){ cout << "There was a problem opening the data file." << endl; return 1; } inputdata >> v; outputdata.open("Converted_data.out"); if(!outputdata){ cout << "There was a problem created the output file." …

Member Avatar
Member Avatar
+1 forum 1

As [URL="http://www.daniweb.com/software-development/c/threads/377568/1625821#post1625821"]Goddess Narues' C code in C forum[/URL] was over my head and her critique of simplistic solution maybe overflowing the integer range was valid in C, I worked out a recursive solution more suitable to my brain in my preferable language. Maybe one day I put in C, now I am too lazy for that. Funny thing is that my simplistic solution is completely sufficient in Python as it has unlimitted precission integers. This code deals any numeric base and also explains about issue is 100 palindromic or not and how to accept or refuse it according to your …

Member Avatar
+0 forum 0

There was little buggy version of Python base conversion around, so here quick hack for my own program, including test with random numbers to verify it.

Member Avatar
Member Avatar
+0 forum 5

I have a C++ standard related question. Let's say I have 2 derived object D1 and D2 (which may contain class D virtual functions) of an identical class base B. Now, I create base pointers bpD1 and bpD2 to those objects. 1) Are bpD1 and bpD2 *guaranteed* to be different if the derived part of D1 and D2 are different even though the base part have identical values, OR, 2) does the c++ standard authorise a smart optimised compiler to use an identical value for bpD1 and bpD2 when it later sees in the code that the derived (different) parts …

Member Avatar
Member Avatar
+0 forum 10

Hey guys I have a program im doing for fun, I need to be able to enter a minimum exponent and a maximum exponent as well as a base. CANNOT USE THE POW() FUNCTION. Ex. minimum exponent = -2 maximum exponent = 3 base = 2 output: base exponent result 2 -2 0.25 -1 0.5 0 1 1 2 2 4 3 8 Here is what I have so far. [CODE] #include <iostream.h> void ExpPow(float &res, int base, int count); void negexp(float &res, int base, int count); int main() { int base; int expow; int expomax; int count; float res …

Member Avatar
Member Avatar
+0 forum 6

The End.