今天用Ruby写了以下代码并进行了测试:#正则表达式 line = getsif line =~ /Perl|Python/ #如果在字符串中匹配了模式,=~返回字符串中匹配模式的开始位置 puts "Scripting language mentioned: #{line}"end我认为/P...
分类:
其他好文 时间:
2015-12-20 17:23:03
阅读次数:
218
11-3:字符串 输出 三个标准的函数:puts() fputs() printf() 1.puts()函数: #include#define DEF "I an a #define string ."int main(){ char str1[80] = "An array was i...
分类:
其他好文 时间:
2015-12-16 12:15:16
阅读次数:
187
水A - Magic Spheres这题也卡了很久很久,关键是“至少”,所以只要判断多出来的是否比需要的多就行了。#include using namespace std;#define lson l, mid, o = less) puts ("Yes"); else puts ("No"); ....
分类:
其他好文 时间:
2015-12-13 12:27:02
阅读次数:
142
puts()函数是C语言中的输出函数。uts()函数用来向标准输出设备(屏幕)写字符串并换行,其调用方式为,puts(s);其中s为字符串字符(字符串数组名或字符串指针)。函数原型:int puts(const char *string);参数:string const的字符类型的指针返回值: in...
分类:
编程语言 时间:
2015-12-08 18:24:54
阅读次数:
387
gets和puts:都是只能读入或者输出一个字符串,gets可以接受空格,puts自带回车技能。strcy “字符串复制函数” 将字符串2复制到字符串1当中strcpy(str1,str2);字符串1的长度需要足够大,一边有足够的容量来储存被复制的字符串2。字符串2可以是字符数组名,可以以是字符串....
分类:
其他好文 时间:
2015-11-28 00:59:26
阅读次数:
162
# definefrench_string = "il \xc3\xa9tait une fois"long_string = "1 and a 2 and a 3 and a "puts data.join(' and a ')# numbernumber = 5puts "The number....
分类:
其他好文 时间:
2015-11-26 19:03:00
阅读次数:
124
对于字符串的处理函数gets()和puts()的结束标志有必要讨论一下gets()函数是从标准输入设备读取字符串直到换行符结束,但是换行符会被丢弃,并且在末尾加上一个字符串结束标志‘\0‘,而与其相对应的puts()函数是将从标准输入设备输入的字符串打印到屏幕上,但是在打印的时候它会..
分类:
其他好文 时间:
2015-11-03 00:49:18
阅读次数:
155
Running a Loop 1,run: Puts the receiver into a permanent loop, during which time it processes data from all attached input sources. Discussion If no input sources or timers are attached to the run ...
分类:
其他好文 时间:
2015-10-27 13:39:21
阅读次数:
255
页面: 下载java代码:public class Download extends HttpServlet { public Download() {
super();
} public void destroy() {
super.destroy(); // Just puts...
分类:
编程语言 时间:
2015-10-22 12:38:20
阅读次数:
209
1. 写出文件#include main(){FILE * f=fopen("data.txt","w");if(f!=NULL) //quan xian {//fputc('A',f);fputs("hello world",f);fclose(f);}else{puts("File can no...
分类:
其他好文 时间:
2015-10-14 16:01:18
阅读次数:
156