simeesta's Profile User Rating: *****

Reputation: 219 Stalwart
Group:
Active Members
Active Posts:
592 (0.3 per day)
Joined:
04-August 09
Profile Views:
14,503
Last Active:
User is offline Sep 05 2014 03:27 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
AMD
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   simeesta is wondering what his status is.

Posts I've Made

  1. In Topic: What is making this an abstract class?

    Posted 1 Aug 2014

    At a guess I'd say it would be lines 14-17 in your manager class. This says is has 3 pure virtual functions. It shouldn't as you given implementations later on.

    I think you need to understand the difference between a virtual function and a pure virtual function. Have a look at this.
  2. In Topic: Bitwise operations - float distance in C

    Posted 22 Jul 2014

    Quote

    My process was to extract the mantissa and exponent, increment the mantissa, increment the exponent if it overflows, reconstruct the value and subtract the distance between them.


    Why not have extractMantissa(int), extractExponent(int) and getNextFloat(int) functions. Then you can test them.

    This might be helpful.


    Why are you initializing your mantissa and exponent to 0xff?

    unsigned int exponent = 0xff;
       for (int i = 24; i < 31; i++) {
                       if (((1 << i) & floatbits) != 0) exponent = exponent | 1 << i;
       }
    
    

    should probably be
    ...
    //this moves the bits to the far right.
    if (((1 << i) & floatbits) != 0) exponent = exponent | 1 << i - 24;
    ...
    
    

    I see that you increment the exponent. In your case the exponent will look like
    0xxxxxxxx00...00 then when you increment it, it will look like 0xxxxxxxx00...01 where xxx are the exponent bits. You will also have to take this into account when constructing the bit pattern.

    What is floatbits?

    if (mantissa != mantissa) exponent++; // if it overflows, increment the exponent too.
    
    

    This does not check for overflow. mantissa != mantissa will always be false. To check if there was overflow you could check after the addition if bit 23 is 1 or not. Hint use (0x1 << 23).

    It's much easier to get bits using masks rather than loops eg.
    int mantissa = bitnumber & 0x7fffff;
    int exponent = (bitnumber & (0xff << 23)) >> 23;
    
    
  3. In Topic: Basic Structure

    Posted 2 Jul 2014

    #include<iostream>
    // This is a preprocessor directive. It allows functions defined in iostream.h to be used
    using namespace std;
    // C++ has something called namepsaces. This says to use the namespace called std.
    
    int main() {
    //this is the starting point of any C++ program. Every C++ program has a function called main()
      cout << "Hello World!" << endl;
      return 0;
    }
    
    

    More info:

    preprocessor
    namespaces

    To learn C++, I suggest to start tutorials online such as this, instead of asking for "some more basic stuff".
  4. In Topic: Cyclic Cipher - Issues with .size()

    Posted 30 Jun 2014

     cin  >> str;
    
    will only read in the first "word".

    Have a look at the getline() method to read in an entire line.

    I meant this getline().
  5. In Topic: Comparing 2D Char array

    Posted 22 Jun 2014

    Shouldn't it be
    myArray[i][j] <='9'
    
    

    myArray[j] is of type char* which is why you're getting a conversion error.

My Information

Member Title:
Deadly Ninja
Age:
23 years old
Birthday:
September 29, 1991
Gender:
Location:
London
Interests:
Computers, Maths, Karate, Films, Games.
Full Name:
Simon
Years Programming:
4
Programming Languages:
C/C++, Haskell, Java, X86/X86-64 assembler, prolog, MATLAB.

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://
Facebook:
http://www.facebook.com/sapensadler

Comments

Page 1 of 1
  1. Photo

    David W Icon

    07 Jun 2012 - 01:52
    Whow ... you may like to see/use some of the C help files like
    readLine.h
    Cvec.h
    Clist.h
    and their help function files
    at ...
    http://developers-heaven.net/forum/index.php/topic,2580.0.html
    and ...
    http://developers-heaven.net/forum/index.php/topic,2582.0.html
Page 1 of 1