如果不得已需要全局变量,则使全局变量加前缀 g_(表示 global). 例如: int g_howManyPeople; // 全局变量 int g_howMuchMoney; // 全局变量 #include <iostream> #include<string.h> /* run this program using the console pauser or add your own getch, system("pause") or input loo
问题:导入excel表,若表格中为整数数字,不管单元格设置成数字格式还是文本格式,导入时都会出现小数点和0. 我遇到的问题是:一个名称,做测试数据的时候做了纯整形数字,发现了这个问题. 解决办法:在代码中判断,格式化一下. /** * 处理导入小数点 */ public static String numOfImport(HSSFCell cell) { String value = cell.toString(); int i = cell.getCellType(); if (i == 1)
从newsPager中得到newsDetailTitles标题的详细内容,这是通过构造器传过来的.打印日志78行能打印,45行打印出来共size是12.但是程序出现了异常java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged. 从网上查询的结果是adapter中的数
leetCode有道题Reverse Integer,因为int的最大值为2的31次方减一,最小值为-2的31次方. 我一开始的代码将res递归加放在try中,以为溢出会有异常,然而并没有. 因为出传入的参数为int类型,且内存和时间要求都能满足,所以long存放中间结果足够了.leet上有个哥们用了一种更机智的溢出检测(自己去看:D) 我的代码: public class Solution { public int reverse(int x) { if(x<=9&&x>=-
Add Date 2014-09-23 Maximum Product Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest product =