Can I make a DataType ?

This is a discussion on Can I make a DataType ? within the C++ Programming forums, part of the General Programming Boards category; to solve "algorithm 196" I want a new DataType(C++ Numeric) which can contain minimum 64 byte. Can it possible? I ...

  1. #1
    Registered User
    Join Date
    Oct 2006

    Can I make a DataType ?

    to solve "algorithm 196" I want a new DataType(C++ Numeric) which can contain minimum 64 byte.

    Can it possible?
    I think possible, but i don't know How?

    Please, Help me.
    Last edited by Salem; 12-13-2006 at 05:28 AM. Reason: snip off-board contact information

  2. #2
    "I Win!" by U. Lose vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    you create class that internally stores the data, for example as a string, or array of digits, or something else
    and you overload all mathimatical operations for your class
    To be or not to be == true

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    You mean this algorithm?

    If you want big numbers, try
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Mar 2006
    64-bit... ha ha ha.
    196 has been brought to >270,000,000 digits.

    You appear to want to solve it using 64-bit numbers... fat chance, mate.

    Salem: the 196 problem only involves addition and (decimal) digit reversal. Addition is simple enough to implement on its own, and it would be cumbersome to constantly convert back-and-forth between binary and decimal if one were to use GMP. The crazy people who work on this apparently favour assembly though (ugh ).
    #include <stdio.h>
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to make a Packet sniffer/filter?
    By shown in forum C++ Programming
    Replies: 2
    Last Post: 02-22-2009, 08:51 PM
  2. "Cannot make pipe"
    By crepincdotcom in forum C Programming
    Replies: 5
    Last Post: 08-16-2004, 12:43 PM
  3. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  4. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM
  5. Replies: 6
    Last Post: 04-20-2002, 06:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21