[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time ]
Subject: Villa bkinni, ea er g bara ruglu essu?

Heia Mara
[ Next Thread | Previous Thread | Next Message | Previous Message ]
Date Posted: 23:47:00 01/29/04 Thu

Sl ll.

g var a lesa essa blessuu reikniritabk og stoppai litlum dmum sem tekin eru bls. 41. ar er sagt a me eim s hgt a reikna t minnstu heiltlu sem s samt strri en lgN, og a s tala eigi a tkna fjlda bita sem arf til a tkna N tvundakerfinu.

g prfai a gamni a forrita etta, t.d. fyrir N=32 en fkk mismunandi t r dmunum tveimur... Hr er kinn:

using namespace std;

int main()
int lgN;
int N = 32;
int N1 = N;

for (lgN = 0; N > 0; lgN++, N /= 2);// gefur 6
cout << "lg" << N1 << " = " << lgN << endl;

N = N1;
int t;

for (lgN = 0, t = 1; t < N; lgN++, t += t);//gefur 5
cout << "lg" << N1 << " = " << lgN << endl;

return 0;

etta ekki a vera 5? Er etta ekki bara vitlaust a a eigi a finna minnstu heiltlu sem er strri? Ea hva???

[ Next Thread | Previous Thread | Next Message | Previous Message ]

Subject Author Date
Re: Villa bkinni, ea er g bara ruglu essu?No name23:48:53 01/29/04 Thu
a er villa bkinni og ert lka eitthva a misskiljaSiggiSveinn12:55:18 02/01/04 Sun

Post a message:
This forum requires an account to post.
[ Create Account ]
[ Login ]
[ Contact Forum Admin ]

Forum timezone: GMT+0
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.