Computing desk | ||
---|---|---|
< July 11 | << Jun | July | Aug >> | July 13 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
Now that M$ baked in insecurity has been leaked...
http://www.guardian.co.uk/world/2013/jul/11/microsoft-nsa-collaboration-user-data
Isn't it a violation of the Health Insurance Portability and Accountability Act to use any M$ spyware in any doctor's office, hospital or insurance company? Hcobb (talk) 00:49, 12 July 2013 (UTC)
When I ran CPU-Z with my Core i7 2600K at factory settings, which include FSB at 100.0 MHz, CPU-Z reported the front-bus speed as actually 99.77 MHz, and a CPU clock speed consistent with that slightly slower FSB. I've since changed my FSB setting in BIOS to 100.3 MHz, and CPU-Z reports 100.10 MHz. Does this mean the CPU clock is running slower than the real-time clock? If so, which one is likely to measure a second more accurately? (I bought the CPU and motherboard at the same time.) NeonMerlin 13:10, 12 July 2013 (UTC)
Hey there! I was working with nested switch case in C++ language. The code i developed gives 0 error and 0 warning. But it does not execute any of the switch. It just exit. Can any one please tell me where the mistake is . I have got stuck. Any help will be highly appreciated. Thanks
C++ code
|
---|
# include <iostream>
# include <math.h>
# include <conio.h>
using namespace std;
int main()
{
int option; // variable for option for the type of photo
int op; // option for size of photo
int np; // option for number of photos
int cop; // cost of photo
cop= 10; // price of one photo
int cost_photo;
cout<<"\nEnter the option number from following for the type of photo you need";
cout<< "\n1. coloured photograph" ;
cout<<" \n2. Black & White photograph";
cout<< "\n3. sketch " <<endl ;
cin>> option ;
switch (option)
{
case '1':
cout<< " \n1.Passport size photograph"<<endl;
cout<<"\n 2.9 x 4 photograph";
cout<<"\n 3.5 x 11 photograph";
cout<< "\nplease enter the photo size option fron above options\n";
cin>> op; // takes the option as input for size of photo
switch (op)
{
case '1':
cout<< "\nHow many photgraphs are required\n";
cin>>np;
cost_photo= (cop*np)+5;
cout<< " Your total bill is "<<cost_photo<<endl ;
break;
case '2':
cout<< "\nHow many photgraphs are required\n";
cin>>np;
cost_photo= (cop*np)+10;
cout<< " Your total bill is "<<cost_photo<<endl ;
break;
case '3' :
cout<< "\nHow many photgraphs are required\n";
cin>>np;
cost_photo= (cop*np)+15;
cout<< " Your total bill is "<<cost_photo<<endl ;
break;
default:
cout<<"Please enter the correct option";
}
break;
case '2':
cout<< " \n1.Passport size photograph";
cout<<"\n2.'9 x 4' photograph";
cout<<"\n3.'5x11' photograph";
cout<< "\nplease enter the size option\n";
cin>>op; // takes the option as input for size of photo
switch (op)
{
case '1':
cout<< "\nHow many photgraphs are required\n";
cin>>np;
cost_photo= (cop*np)+20;
cout<< " \nyour total bill is "<<cost_photo ;
break;
case '2':
cout<< "\nHow many photgraphs are required\n";
cin>>np;
cost_photo= (cop*np)+30;
cout<< "\n your total bill is "<<cost_photo ;
break;
case '3':
cout<< "\nHow many photgraphs are required";
cin>>np;
cost_photo= (cop*np)+45;
cout<< " Your total bill is "<<cost_photo<<endl ;
break;
default:
cout<<"Please enter the correct option";
}
break;
case '3':
cout<< " \n1.Pencil sketch";
cout<<"\n2.'charcoal sketch";
cout<< "\nplease enter the sketch type option\n";
cin>>op; // takes the option as input for size of photo
switch (op)
{
case '1':
cout<< "\nHow many photgraphs are required";
cin>>np;
cost_photo= (cop*np)+20;
cout<< " Your total bill is "<<cost_photo<<endl ;
break;
case '2':
cout<< "\nHow many photgraphs are required";
cin>> np;
cost_photo= (cop*np)+30;
cout<< " Your total bill is "<<cost_photo<<endl ;
break;
default:
cout<<"Please enter the correct option";
}
break;
}
getch();
return 0;
}
|
Mike robert (talk) 15:29, 12 July 2013 (UTC)
int option;
cin >> option;
if (option == '1') ...
The frexp function found in the standard c library exists as a function in JavaScript? I've looked everywhere but I've found nothing. Where can I find it? 181.50.178.92 (talk) 23:42, 12 July 2013 (UTC)
function float_as_int(fl){
var ab = new ArrayBuffer(4);
var fa = new Float32Array(ab);
fa[0] = fl;
return new Uint32Array(ab)[0];
}
console.log(float_as_int(3.1415));
float pi = 3.1415;
printf ("pi as an integer:%d\n", *(uint32_t*)&pi);
var num = float_as_int(3.1415);
var exponent = (num & 0x7f800000) >> 23;
var fraction = num & 0x7fffff;
#!/usr/bin/python
import math
x = -4271.437 # example input
exp=0;
while (2**exp < abs(x)):
exp += 1
fr = x / 2**exp
result = (fr, exp)
print (result)
print (math.frexp(x)) # sanity check against the math.frexp version
<HTML>
<BODY>
<!--
<SCRIPT language="javascript">
var x = 4271.437;
var exp = 0;
while(Math.pow(2,exp) < Math.abs(x))
{
exp += 1;
}
var fr = x / Math.pow(2,exp);
document.write("<br/>FR=");
document.write(fr);
document.write("<br/>EXP=");
document.write(exp);
</SCRIPT>
//-->
</BODY>
</HTML>