#!/usr/bin/expect
set timeout 30
spawn ssh -p [lindex $argv 0] [lindex $argv 1]@[lindex $argv 2]
expect {
"(yes/no)?"
{send "yes\n";exp_continue}
"password:" ...
分类:
其他好文 时间:
2015-01-06 12:16:12
阅读次数:
167
输入一个字符串,判断是否含有相同的子串(字串长度大于1),是输出1,否,输出0。
例如12312含有两个12,所以输出1;23456则没有相同子序列,输出0.
输入:12312
输出:1
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
string s;
cin>...
分类:
其他好文 时间:
2015-01-06 00:51:48
阅读次数:
198
输入一个字符串,去掉重复出现的字符,并把剩余的字符串排序输出。
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
string s;
while(cin>>s)
{
for(int i=0;i<s.size();++i)
for(i...
分类:
编程语言 时间:
2015-01-06 00:51:40
阅读次数:
232
#include
#include
#include
#include
#include
int main (int argc, char *argv[])
{
typedef int KeyType;
typedef float MappedType;
typedef std::pair ValueType;
typedef boost::interp...
分类:
其他好文 时间:
2015-01-05 20:32:30
阅读次数:
511
输入多个字符串,分别提取出里面的数字,排序输出所有的数字。
#include
#include
#include
#include
#include
using namespace std;
vectorvec;
int main(int argc, char *argv[])
{
int n;
string s;
while(cin>>n)
{...
分类:
编程语言 时间:
2015-01-05 00:36:07
阅读次数:
206
输入一个字符串,输出出现次数最少,或者说出现频率最小的字符。
#include
#include
#include
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
string s;
cin>>s;
mapm;
for(string::size_type i=0...
分类:
其他好文 时间:
2015-01-05 00:34:23
阅读次数:
174
环境变量
一些命令
shell脚本中经常出现各种环境变量,因此要写脚本,必须先来了解环境变量.常见的处理环境变量的命令,列举在下面
set 用来显示本地变量env 用来显示环境变量export 用来显示和设置环境变量source 后面跟一个文件,可以直接执行文件里的脚本命令并更新
常见的环境变量
位置参数
相当于C语言中, main函数的argv数组, 这里用 $num 表...
分类:
系统相关 时间:
2015-01-04 23:09:24
阅读次数:
363
1 #include 2 3 int binarySearch(int *array, int length, int num); 4 int main(int argc, const char * argv[]) { 5 6 int array[] = {1, 2, 3, ...
分类:
编程语言 时间:
2015-01-04 21:15:04
阅读次数:
163
1. getopt模块:getopt模块用于抽出命令行选项和参数,也就是sys.argv。命令行选项使得程序的参数更加灵活。支持短选项模式和长选项模式。1) 主要函数:getopt(args, shortopts, longopts = [])参数:=====- args 通常是: sys.argv...
分类:
编程语言 时间:
2015-01-04 18:49:00
阅读次数:
168
#include int fatorialWithNum(int num);int main(int argc, const char * argv[]) { @autoreleasepool { int result = fatorialWithNum(6); ...
分类:
其他好文 时间:
2015-01-04 17:03:11
阅读次数:
135