Forum: Computer Science Jul 26th, 2009 |
| Replies: 4 Views: 494 I doubt it can be done with the command-line, but it could be done with the WSH, which comes preinstalled.
var fso,a,s,d,f,t,t0,t1;
var dr;
dr='c:\\mydocu~1\\test';
fso=new... |
Forum: Computer Science Jul 26th, 2009 |
| Replies: 12 Views: 1,140 But obviously going through numbers from 0 to 2^n would exceed time limit way before it exceeds the limit of a long int. |
Forum: JavaScript / DHTML / AJAX Jul 17th, 2009 |
| Replies: 4 Views: 440 You could look at this:
http://en.wikipedia.org/wiki/XMLHTTP#caching |
Forum: Computer Science Jul 17th, 2009 |
| Replies: 2 Views: 554 The equation you gave, if the first term is corrected to t(k), should give a complexity of O(nk log k). Another algorithm that could do this was to use a heap -- it was so that you could get the... |
Forum: Computer Science Jul 17th, 2009 |
| Replies: 12 Views: 1,140 At least for n<30 bits (which is probably near the maximum on one fast processor), you could just have a for loop from 0 to 2^n and get the binary representation for each number. |
Forum: C++ Jul 6th, 2009 |
| Replies: 8 Views: 951 Look at post #3... the original poster seems to want to truncate the float to 1 dp.
And please close your code tag properly! |
Forum: C++ Jul 4th, 2009 |
| Replies: 11 Views: 344 It will only do this forever: output "x=.." and input a number |
Forum: C++ Jul 4th, 2009 |
| Replies: 8 Views: 951 Yeah I didn't realise your "caveat" that negative values would be truncated wrongly... but if you want an easier way other than if loops:
// #include<cmath>
float t=31.4592,x;
modf(t*10,&x);... |
Forum: C++ Jul 4th, 2009 |
| Replies: 8 Views: 951 You could do this:
// #include<cstring>
float t=31.4592;
char num[100];
sprintf(num,"%f",t);
p=strchr(num,'.');
if( p!=NULL ) num[p-num+2]=0;
printf("%s\n",num); |