Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: multiply  (Read 14324 times)

0 Members and 1 Guest are viewing this topic.

smeezekitty

  • Guest
Re: multiply
« Reply #15 on: August 24, 2009, 11:34:12 AM »
Visual Basic, in the immediate window, First as a Single Precision calculation, then as Double Precision, and finally using the Decimal Variant subtype. :)

(note that "?n" in the immediate window is the same as "Print n")
Code: [Select]
?111111111! * 111111111!
 1.234568E+16
?111111111# * 111111111#
1.23456789876543E+16
?cdec(111111111) * cdec(111111111)
12345678987654321
thats why

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: multiply
« Reply #16 on: August 24, 2009, 11:38:11 AM »
WHAT is why? WHAT reason?


that it gives an accurate result? Because it has an immediate window? Because Variant Subtypes are so scary and foreign to you and thus must be evil?
I was trying to dereference Null Pointers before it was cool.

smeezekitty

  • Guest
Re: multiply
« Reply #17 on: August 24, 2009, 11:45:46 AM »
heres a floating point calculator in C++
Code: [Select]
#include <iostream.h>
#include <stdio.h>
int main(){
float a,b;
cout<<"Enter first number:";
cin>>a;
cout<<"Enter second number";
cin>>b;
printf("\n*THE ANWSER IS:%0.4f*\n", (float) a+b);
return (-0);
}


BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: multiply
« Reply #18 on: August 24, 2009, 11:52:26 AM »
*censored* does that have to do with anything?

let me emphasis this for you- that was NOT VB6 code

Code: [Select]
Sub Main()
    Dim A,B
    A = Cdec(Val(Inputbox$("Enter first number")))
    B=  Cdec(Val(Inputbox$("Enter second number")))
    msgbox A+B
End Sub

Additionally, it has the advantage of not causing a fatal error when you enter straight text.

AND it doesn't display the results in scientific notation (due to the use of the Variant Decimal subtype).

I was trying to dereference Null Pointers before it was cool.

smeezekitty

  • Guest
Re: multiply
« Reply #19 on: August 24, 2009, 11:57:25 AM »
here is one that doesnt cause a fatal error
if the user enters junk input
Code: [Select]
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
int main(){
float fa,fb;
char a[24],b[24];
cout<<"Enter first number:";
cin>>a;
cout<<"Enter second number";
cin>>b;
fa=atof(a);
fb=atof(b);
printf("\n*THE ANWSER IS:%0.4f*\n", (float) fa+fb);
return (-0);
}

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: multiply
« Reply #20 on: August 24, 2009, 12:07:11 PM »
you completely missed my point... I ask you to fill in the fairly vague statement "and thats why i dont use any thing based on basic" and you come back and post some random C program. That tells me nothing about why you won't use anything based on BASIC it just tells me that you enjoy mixing the C++ iostream overloaded operator paradigm with the use of printf() for output thus requiring you to include both stdio and iostream into your program. Settle on printf and scanf or cout and cin, mixing the two is just a demonstration in incompetence (although in this case it's not crucial, it just seems strange to mix the two). And yes, cout DOES support output formatting, it's somewhere in the iostream namespace, I believe.

Additionally, regarding the "new" improved program with "security fixes"...

what happens if you enter 25 characters via cin?

or for that matter, what if you were to enter 24 characters into the second number, and then have some carefully conditioned output that changes the return address by overwriting the stack frame with a new return location... and making that new location point to a NOP sled leading into malicious code, namely a call to execute the local shell. If for some reason your program was run as an administrator then that crafted input now executes a shell window that has administrator privileges!

Dear me! This is even WORSE then it was before!

(of course nobody is A: going to run it as admin or B: use it as an attack vector, but when your writing code you have to consider all the possibilities, if a tiny addition program can contain such a large security hole, well, gee whiz, bigger programs don't stand a chance! (It'll be sendmail all over again....))

lol
I was trying to dereference Null Pointers before it was cool.

smeezekitty

  • Guest
Re: multiply
« Reply #21 on: August 24, 2009, 12:13:32 PM »
its just a demo my god
hackers are more intrested in writing there own programs
usual because they can get money from people
and run malicious code

kpac

  • Web moderator


  • Hacker

  • kpac®
  • Thanked: 184
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: multiply
« Reply #22 on: August 24, 2009, 01:01:39 PM »
Quote
hackers are more intrested in writing there own programs
Don't tell me you know how to hack...

Aegis



    Expert

    Thanked: 67
    • Yes
    • Yes
    • Brian's Mess Of A Web Page
  • Experience: Experienced
  • OS: Windows 10
Re: multiply
« Reply #23 on: August 24, 2009, 01:16:51 PM »
Quote
hackers are more intrested in writing there own programs

In true hacker culture, hackers are the good guys.

Quote
usual because they can get money from people
and run malicious code

Have there been any real cases of crackers blackmailing / extorting money to keep from running their code?





"For you, a thousand times over." - "The Kite Runner"

smeezekitty

  • Guest
Re: multiply
« Reply #24 on: August 24, 2009, 02:15:35 PM »
i mean its a virus that they make money off too
for example Xp antispy virus
that some less experanced user may pay for
so its a virus and you just paid the hacker

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: multiply
« Reply #25 on: August 24, 2009, 02:23:51 PM »
that's not a virus... that's a rogue program... and they aren't developed by a single person in their basement, they're developed by teams of people in their basements.
I was trying to dereference Null Pointers before it was cool.

smeezekitty

  • Guest
Re: multiply
« Reply #26 on: August 24, 2009, 02:25:33 PM »
false postives and always starting to windows even if you uncheck auto start
sounds virusy to me

kpac

  • Web moderator


  • Hacker

  • kpac®
  • Thanked: 184
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: multiply
« Reply #27 on: August 24, 2009, 02:27:43 PM »
Quote
sounds virusy to me
I'd get a hearing test if I were you.

smeezekitty

  • Guest
Re: multiply
« Reply #28 on: August 24, 2009, 02:32:32 PM »
i used a non word on purpose
calm down evreyone

computeruler



    Egghead

    Thanked: 63
    • Yes
    • Yes
  • Experience: Experienced
  • OS: Mac OS
Re: multiply
« Reply #29 on: August 24, 2009, 02:33:55 PM »
ya so? A rouge program and a virus are completely different, hence kpacs post