KYA's Profile User Rating: *****

Reputation: 3153 Guru
Group:
Alumni
Active Posts:
19,343 (6.64 per day)
Joined:
14-September 07
Profile Views:
146,494
Last Active:
User is offline Aug 09 2015 05:03 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Honda
Dream Kudos:
3300
Expert In:
C, C++, Java

Latest Visitors

Icon   KYA likes Ruby

Posts I've Made

  1. In Topic: What should I learn next?

    Posted 27 Jul 2015

    Shameless plug: A Visual Guide of the C++ Compilation Process.
  2. In Topic: [C] Request For Member not in Structure or Union

    Posted 21 Jul 2015

    You have a period in your printfstatement. You need to pass printf a list of parameters and the delimiter is a comma:

    printf("The total is %d".total); /* bad */
    printf("The total is %d", total); /* good */
    
    
  3. In Topic: Getting double digit from a file.

    Posted 19 Jul 2015

    It really all depends on your constraints. Are you only delimiting numbers by operators?

    i.e

    1+2?

    If you guaranteed no whitespace (or already account for it). You need to account for each digit being a power of ten (see above). Once you hit the end of a number, you sum it up based on the powers of ten and that is your number.

    So the rough algorithm:

    if i find a digit mark a flag
    continue until i find a non digit character
    go backwards and construct the number
    store/print out

    Something I whipped up:

    #include <cstdio>
    #include <cctype>
    #include <cstring>
    #include <cstdlib>
    #include <cmath>
    
    const char* str = "22+45";
    int main(){
      bool digitFlag = false;
      int base = 0;
      printf ("Input string %s\n", str);
      for(int i =0; i < strlen(str); i++){
        //printf("char %c\n", str[i]);
        if (isdigit(str[i]) && !digitFlag) { //flag start of digit
          digitFlag = true;
          base = i;
        }
        else if (str[i] != 0x0a && digitFlag) {
          digitFlag = false;
          //number is from base - i
          int number = 0;
          //printf("in non number last digit %c\n", str[i]);
          for(int start = i-1, powr = 0; start >= base; start--, powr++){
            //printf("pow option %d\n", atoi(&str[start])*(pow(10, powr)));
            number += atoi(&str[start])*(pow(10, powr));
          }
          printf("found number %d\n", number);
          base = 0;
        }
      }
      //whatever is last in the buffer here
      return 0;
    }
    
    


    Quote

    Input string 22+45
    found number 22
    found number 45
  4. In Topic: How to print path of linked list?

    Posted 19 Jul 2015

    What? How do you only have one function? Riiiiight.

    I recommend some reading:

    Linked Lists
    Binary Search Trees
  5. In Topic: Getting double digit from a file.

    Posted 19 Jul 2015

    What is the purpose of blindly pulling 20 characters from the file? Is the file formated a certain way? I would craft extraction along those lines.

    This looks like a calculator app. You're splitting 25 into 2 and 5 because that is what your code is doing. You're checking one digit at a time. You need to handle delimiting of integers from operands/symbols/et al.

My Information

Member Title:
g++ jameson.cpp -o beverage
Age:
27 years old
Birthday:
February 8, 1988
Gender:
Location:
U.S.
Full Name:
Knowles Y. Atchison, Jr.
Years Programming:
10
Programming Languages:
C, C++, Java (Experienced)
Ruby, Lua

Contact Information

E-mail:
Private
Website URL:
Website URL  http://knowlesatchison.net
LinkedIn:
http://www.linkedin.com/in/knowlesatchison
Twitter:
_KYA

Comments

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  1. Photo

    guilpter Icon

    08 Jun 2015 - 06:54
    Hi there i read your Huffman solution, http://www.dreamincode.net/forums/blog/324/entry-3150-an-in-depth-look-at-huffman-encoding/ I wanted to ask you if you have a file compression version ?
  2. Photo

    mireille4U Icon

    30 Apr 2015 - 05:23
    Greeting from mireille i saw your profile today and i became interested in you and i will like to know more about you and if you can mail an email to my mail address (mireille4u@live.com) i will give you my picture.here is my mail address i hope we can move from here.above. Mireille
  3. Photo

    Michael26 Icon

    25 Jun 2013 - 15:43
    Reputation: 3000
    Nice round number :)
  4. Photo

    Highdrox Icon

    05 Apr 2013 - 07:37
    Hello,
    Our community Digital Dominance is preparing to launch, we do have 1 coder right now but are looking for another coder to join and help produce cheats for the MultiPlayer Game Hacking community.
    There is potential to make some good money and build a name as a coder.
    If you are interested please contact me.
    Thanks,
    Highdrox@live.ca
  5. Photo

    Martyr2 Icon

    23 Sep 2012 - 14:15
    Thanks for the five year badge, much appreciated. :)
  6. Photo

    lbrownlbandit Icon

    13 Jun 2012 - 12:40
    Hi , just wondering I could borrow you black jack code http://www.dreamincode.net/forums/topic/75554-blackjack-game/
  7. Photo

    strawhat89 Icon

    12 Jun 2012 - 22:40
    I see you like witty quotes. Have you read Jim Butcher's Dresden Files? Its chock full of witty banter.
  8. Photo

    strawhat89 Icon

    12 Jun 2012 - 22:40
    I see you like witty quotes. Have you read Jim Butcher's Dresden Files? Its chock full of witty banter.
  9. Photo

    no2pencil Icon

    21 Feb 2012 - 19:29
    Ich habe eine Koch-Video!
  10. Photo

    blutrane Icon

    13 Feb 2012 - 07:52
    Wo ist der neue Koch-Video?
  11. Photo

    Guest 

    04 Sep 2011 - 07:58
    Hello, with the pudding. Pudd-pudd-pudd-pudd-pudding! Hello, with pudding. Pudding Bill Cosby. PUDDING! Bill Cosby. PUDDING! Bill Cosby. PUDDING! Bill Cosby. Pudding, pudding, pudding, pudding.
    .
    .
    .
    .
    .
    .
    .
  12. Photo

    Shahrzzad Icon

    14 Jul 2011 - 09:29
    Thank u so much for accepting my friend request.:).
    Best.
    Shahrzad.
  13. Photo

    y2161994 Icon

    13 Jul 2011 - 03:23
    Hey friend,can you tell how I can know that My tutorial is approved or not.
  14. Photo

    ishkabible Icon

    28 Jun 2011 - 17:07
    get out of my BIOS, you could corrupt the input...or worse...the output!!
  15. Photo

    no2pencil Icon

    21 Jun 2011 - 11:27
    Post another baby making/cooking video!
  • (3 Pages)
  • +
  • 1
  • 2
  • 3