小编dev*_*ull的帖子

C语言中如何将十进制值转换为字符

我有一个 char 数组,但值是字符的十进制表示形式。例子:

char bytes[4]={50,48,49,51}
Run Code Online (Sandbox Code Playgroud)

如何将其转换为获取 char 数组,如下所示:

char bytes1[4]={2,0,1,3}
Run Code Online (Sandbox Code Playgroud)

c

1
推荐指数
1
解决办法
3万
查看次数

计算 qstat 输出中字符串的出现次数

我正在尝试编写一行 shell 代码来告诉我队列中有多少个作业。

该命令qstat将返回具有以下属性的作业列表:作业 ID、名称、用户、时间使用队列名称

该命令qstat(1B)在手册页中进行了标记。

我尝试计算我正在运行的作业数量grep

grep -c my_username | qstat
Run Code Online (Sandbox Code Playgroud)

my_username据我了解,这应该计算qstat 输出中出现的次数。但这不起作用。有什么想法我哪里出错了吗?

queue bash command-line mingw

1
推荐指数
1
解决办法
732
查看次数

cat 和 fold unix 命令的区别

我想知道以下 2 个命令catfold命令之间的区别?我只是使用fold命令,它的作用就像cat命令一样。

fold file1.txt
cat fold.txt (both are using to display the contents of the file)
Run Code Online (Sandbox Code Playgroud)

unix cat

1
推荐指数
1
解决办法
1371
查看次数

N = 2 ^ x,如果为真,则写入true.为什么这是错的?

请帮我编码.我想做一个像这样的程序.对不起坏英语.

给定输入:

N  
where N is an integer. 
Run Code Online (Sandbox Code Playgroud)

返回:

True  if N = 2^x, where x is an integer.
Run Code Online (Sandbox Code Playgroud)

我试过这样做,但它不能像我想的那样工作.

using namespace std;
int main()
{
    float a,b,c;
    cin>>a;
    c=log10(a)/log10(2.0);
    b=pow(2,c);
    if(b==a)
    {
        cout<<"TRUE"<<endl;}
    else
        cout<<"FALSE"<<endl;{
    }
}
Run Code Online (Sandbox Code Playgroud)

请帮帮我.谢谢.

c++ logarithm pow

0
推荐指数
1
解决办法
185
查看次数

Java正则表达式单词匹配

我有3个值IU,PRIRET.如果我的输入字符串包含任何一个或多个值,
则Java正则表达式应返回true.

Ex:
Values : IU PRI RET 
Input String : "put returns UI between paragraphs"
Run Code Online (Sandbox Code Playgroud)

Input字符串包含"UI"字样,Java正则表达式应返回true.

java regex

0
推荐指数
2
解决办法
3万
查看次数

如何在Bash中创建隐藏文件

什么是bash命令来创建隐藏文件.我想说出来.httName.

我试过谷歌搜索,但没有一个论坛建议任何解决这个问题.我只是在寻找解决问题的命令.如果有人碰巧知道答案,请帮助我.

bash hidden-files

0
推荐指数
1
解决办法
1万
查看次数

突然间,我无法运行python代码

突然间,我无法为放在c:/ python33里面的文件夹中的.py文件运行python代码

我试图创建一个只包含此过程的新.py文件:

def myproc(): 
    print( 'hi')
Run Code Online (Sandbox Code Playgroud)

当试图运行它时,我得到:

>>> from test import myproc
>>> myproc
<function myproc at 0x000000000298A1E0>
Run Code Online (Sandbox Code Playgroud)

我试图在另一个文件夹中运行另一个放在c:/ python中的代码,它运行正常没有任何问题.

我还尝试复制有问题的文件夹并删除旧文件夹,但仍然无法在该有问题的文件夹中运行任何.py文件.

你能告诉我什么问题吗?怎么解决?

python

0
推荐指数
1
解决办法
109
查看次数

while循环里面for循环不起作用

我有一个HashMap.

Map<String,String> lhm = new HashMap<String,String>();
lhm.put("Zara", "biu");
lhm.put("Mahnaz", "nuios");
lhm.put("Ayan", "sdfe");
lhm.put("Daisy", "dfdfh");
lhm.put("Qadir", "qwe");
Run Code Online (Sandbox Code Playgroud)

我想根据属性文件中给出的顺序对该hashmap进行排序.实际上,该属性条目将按某种顺序具有键.我的属性条目将如下所示

seq=Ayan,Zara,Mahnaz,Qadir,Daisy
Run Code Online (Sandbox Code Playgroud)

我对此尝试的是

Map<String,String> lhm = new HashMap<String,String>();
Properties prop=new Properties();
prop.load(new FileInputStream("D:\\vignesh\\sample.properties"));
// Put elements to the map
lhm.put("Zara", "biu");
lhm.put("Mahnaz", "nuios");
lhm.put("Ayan", "sdfe");
lhm.put("Daisy", "dfdfh");
lhm.put("Qadir", "qwe");

// Get a set of the entries
Set<Entry<String, String>> set = lhm.entrySet();
// Get an iterator
Iterator<Entry<String, String>> iter = set.iterator();
// Display elements
String sequence=prop.getProperty("seq");
System.out.println("sequence got here is "+sequence);
String[] resultSequence=sequence.split(","); …
Run Code Online (Sandbox Code Playgroud)

java hashmap

0
推荐指数
1
解决办法
224
查看次数

system()调用在C中返回错误的值

即使通过system()调用成功运行命令后,我得到-1返回值.有关更多信息,请参阅以下C代码.

system("ping -w 3 -c 1 -q -I 63.254.203.24 63.254.203.26 >/dev/null");
Run Code Online (Sandbox Code Playgroud)

然后我检查这个system()调用的返回值,即使它是可ping的但我发现-1作为返回值.

c linux system

0
推荐指数
1
解决办法
539
查看次数

你怎么知道每个字母的频率?

我做过这个但是太长了,我怎么能做一个更简单的方法呢?提前致谢

letter_a = all_words.count('a')

letter_b = all_words.count('b')

letter_c = all_words.count('c')

letter_d = all_words.count('d')

letter_e = all_words.count('e')

letter_f = all_words.count('f')

letter_g = all_words.count('g')

letter_h = all_words.count('h')

letter_i = all_words.count('i')

letter_j = all_words.count('j')

letter_k = all_words.count('k')

letter_l = all_words.count('l')

letter_m = all_words.count('m')

letter_n = all_words.count('n')

letter_o = all_words.count('o')

letter_p = all_words.count('p')

letter_q = all_words.count('q')

letter_r = all_words.count('r')

letter_s = all_words.count('s')

letter_t = all_words.count('t')

letter_u = all_words.count('u')

letter_v = all_words.count('v')

letter_w = all_words.count('w')

letter_x = all_words.count('x')

letter_y = all_words.count('y')

letter_z = all_words.count('z')



print("There …
Run Code Online (Sandbox Code Playgroud)

python counting

0
推荐指数
1
解决办法
573
查看次数

标签 统计

bash ×2

c ×2

java ×2

python ×2

c++ ×1

cat ×1

command-line ×1

counting ×1

hashmap ×1

hidden-files ×1

linux ×1

logarithm ×1

mingw ×1

pow ×1

queue ×1

regex ×1

system ×1

unix ×1