输入10个整形数,输入一个整形m,将整形数m个数字前置,如 1 2 3 4 5 6 7 8 9 10,m=3,输出 8 9 10 1 2 3 4 5 6 7
解题思路:
使用两个堆栈即可。代码如下:
#include
#include
using namespace std;
void main()
{
int a[10]={0};
for (int i=0;i<10;i++)
...
分类:
其他好文 时间:
2015-05-15 09:11:05
阅读次数:
103
JVM对象访问解析
对象访问过程的内存情况
public void function(){
Object obj = new Object();
}function方法被执行的时候,JVM在JVM栈中为function创建一个栈帧,用于存放function在运行过程中的一些信息。
Object obj被执行时,JVM在function方法对应的栈帧中的本地变量表中创建Object类型的引用...
分类:
其他好文 时间:
2015-05-15 09:09:43
阅读次数:
177
//异常处理的简单应用。
#include
using namespace std;
int Div(int a, int b)
{
if(b == 0)
{
throw b;
}
cout<<"OK"<<endl;
return a/b;
}
void main()
{
int a,b;
cout<>a>>b;
try
{
cout...
分类:
其他好文 时间:
2015-05-15 09:09:17
阅读次数:
120
1、数据的遍历
public class TestClass {
public static void main(String[] args) {
/*二维数组,每一维可以不一样*/
int a[][] = new int[][]{{1,2,3},{4,5,6},{8,9,10,7}};
Arrays.sort(a[2]);
for(int i=0; i<a.le...
分类:
编程语言 时间:
2015-05-15 09:08:25
阅读次数:
122
Java中break只能跳出当前循环,要想跳出多重循环可以使label标签:
例:
public class StepoverMultiLoop
{
public static void main(String[]
args) {
int count
= 0;
ok:
for (int i
...
分类:
编程语言 时间:
2015-05-15 09:04:21
阅读次数:
146
-(void)play{ //第一种图片动画模式 头尾方式 //头尾方式 [UIView beginAnimations:nil context:nil];//动画开始 [UIView setAnimationDuration:10];//设置动画播放时长 /*内部写图片处理*/ [U...
分类:
移动开发 时间:
2015-05-15 09:01:34
阅读次数:
131
1 #include 2 #include 3 void ojmd(int *a,int *b); 4 5 void ojmd_dg(int *a,int *b); 6 7 int main(void){ 8 int a=12; 9 int b=6;10 ojmd(&a...
分类:
其他好文 时间:
2015-05-15 08:59:59
阅读次数:
107
package JBJADV003;import java.io.*;public class WriteTeacherObj { /** * @param args */ public static void main(String[] args)throws FileNotFoundExce.....
分类:
其他好文 时间:
2015-05-15 01:04:11
阅读次数:
103
- (void)viewDidLoad {//创建layer对象 [super viewDidLoad]; CALayer *layer = [CALayer layer]; layer.position = CGPointMake(100, 100); la...
分类:
其他好文 时间:
2015-05-14 23:44:59
阅读次数:
151
题目概要:《哈利波特》系列书籍共5部,单买每本8元,2本一套买(各不相同为一套,下同),享5%的优惠,以此类推,3本10%,4本20%,5本25%。要求:输入要买的书籍,求出最优购买策略,并求出最低价格。#includeusing namespace std;void main(){ double ...
分类:
其他好文 时间:
2015-05-14 23:29:07
阅读次数:
103