这在c ++中看起来如何? [英] How does this look in c++?

查看:78
本文介绍了这在c ++中看起来如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  function  octalchange()
{
var val = document .chmod.t_total.value;
var ownerbin = parseInt (val.charAt( 0 ))。toString( 2 );
while (ownerbin.length< 3){ownerbin = 0 + ownerbin; };
var groupbin = parseInt (val.charAt( 1 ))。toString( 2 );
while (groupbin.length< 3){groupbin = 0 + groupbin; };
var otherbin = parseInt (val.charAt( 2 ))。toString( 2 );
while (otherbin.length< 3){otherbin = 0 + otherbin; };
document .chmod.owner4.checked = parseInt (ownerbin.charAt( 0 ));
document .chmod.owner2.checked = parseInt (ownerbin.charAt( 1 ));
document .chmod.owner1.checked = parseInt (ownerbin.charAt( 2 ));
document .chmod.group4.checked = parseInt (groupbin.charAt( 0 ));
document .chmod.group2.checked = parseInt (groupbin.charAt( 1 ));
document .chmod.group1.checked = parseInt (groupbin.charAt( 2 ));
document .chmod.other4.checked = parseInt (otherbin.charAt( 0 ));
document .chmod.other2.checked = parseInt (otherbin.charAt( 1 ));
document .chmod.other1.checked = parseInt (otherbin.charAt( 2 ));
calc_chmod( 1 );
};

function calc_chmod(nototals)
{
var users = new Array < span class =code-string> owner
group other);
var totals = new 数组 );
var syms = new 数组 );

for var i = 0 ; i< users.length;> {
var user = users [i];
var field4 = user + 4;
var field2 = user + 2;
var field1 = user + 1;
var symbolic = sym _ + user;
var number = 0 ;
var sym_string = ;

if document .chmod [field4] .checked == true ){ number + = 4 ; }
if document .chmod [field2] .checked == true ){number + = 2 ; }
if document .chmod [field1] .checked == true ){number + = 1 ; }

if document .chmod [field4] .checked == < span class =code-keyword> true
){
sym_string + = r ;
} else {
sym_string + = - ;
}
if document .chmod [field2] .checked == < span class =code-keyword> true
){
sym_string + = w ;
} else {
sym_string + = - ;
}
if document .chmod [field1] .checked == < span class =code-keyword> true
){
sym_string + = x ;
} else {
sym_string + = - ;
}
totals [i] = totals [i] + number;
syms [i] = syms [i] + sym_string;

};
if (!nototals) document .chmod.t_total.value = totals [ 0 ] +总计[ 1 ] +总计[ 2 ]。
document .chmod.sym_total.value = - + syms [ 0 ] + syms [ 1 ] + syms [ 2 ];
}
window .onload = octalchange

解决方案

< blockquote>它不是那样的工作。

我们不为你做你的工作。

如果你想让别人写你的代码,你必须支付 - 我建议你去Freelancer.com并在那里问。



但请注意:你得到的是你付出的代价。支付花生,买猴子。


function octalchange() 
{
	var val = document.chmod.t_total.value;
	var ownerbin = parseInt(val.charAt(0)).toString(2);
	while (ownerbin.length<3) { ownerbin="0"+ownerbin; };
	var groupbin = parseInt(val.charAt(1)).toString(2);
	while (groupbin.length<3) { groupbin="0"+groupbin; };
	var otherbin = parseInt(val.charAt(2)).toString(2);
	while (otherbin.length<3) { otherbin="0"+otherbin; };
	document.chmod.owner4.checked = parseInt(ownerbin.charAt(0)); 
	document.chmod.owner2.checked = parseInt(ownerbin.charAt(1));
	document.chmod.owner1.checked = parseInt(ownerbin.charAt(2));
	document.chmod.group4.checked = parseInt(groupbin.charAt(0)); 
	document.chmod.group2.checked = parseInt(groupbin.charAt(1));
	document.chmod.group1.checked = parseInt(groupbin.charAt(2));
	document.chmod.other4.checked = parseInt(otherbin.charAt(0)); 
	document.chmod.other2.checked = parseInt(otherbin.charAt(1));
	document.chmod.other1.checked = parseInt(otherbin.charAt(2));
	calc_chmod(1);
};

function calc_chmod(nototals)
{
  var users = new Array("owner", "group", "other");
  var totals = new Array("","","");
  var syms = new Array("","","");

	for (var i=0; i<users.length;>	{
	  var user=users[i];
		var field4 = user + "4";
		var field2 = user + "2";
		var field1 = user + "1";
		var symbolic = "sym_" + user;
		var number = 0;
		var sym_string = "";
	
		if (document.chmod[field4].checked == true) { number += 4; }
		if (document.chmod[field2].checked == true) { number += 2; }
		if (document.chmod[field1].checked == true) { number += 1; }
	
		if (document.chmod[field4].checked == true) {
			sym_string += "r";
		} else {
			sym_string += "-";
		}
		if (document.chmod[field2].checked == true) {
			sym_string += "w";
		} else {
			sym_string += "-";
		}
		if (document.chmod[field1].checked == true) {
			sym_string += "x";
		} else {
			sym_string += "-";
		}
		totals[i] = totals[i]+number;
		syms[i] =  syms[i]+sym_string;
	
  };
	if (!nototals) document.chmod.t_total.value = totals[0] + totals[1] + totals[2];
	document.chmod.sym_total.value = "-" + syms[0] + syms[1] + syms[2];
}
window.onload=octalchange

解决方案

It doesn't quite work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.

But be aware: you get what you pay for. Pay peanuts, get monkeys.


这篇关于这在c ++中看起来如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆