if y==15
x=1
end
m=15n=5x=0
for i=1:n
set(i)=i
end
position=n
while set(1) <m - n + 1
if(set(n)==m)
position=position-1
else
position =n
end
set(position)=set(position)+1
for i=position+1:n
set(i)=set(i-1)+1
end
if set(5)+set(1)+set(2)+set(3)+set(4)==y
x=x+1
end
end
disp(['when y= ' num2str(y) ' so you want to look ' num2str(x)])
end
C语言虽然没有这类的函数陵盯岩,但是您完全可尺御以使用File类文件 *** 作来重新打开一个文件进行写入,该文件被则侍彻底清空了。微软MSDN上有此类例子: FILE * fopen (const char * filename, const char * mode)Mode:"w "
Create an empty file for writing. If a file with the same name already exists its content is erased.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)