This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
// Converts string of decimal digits to numeric type. | |
template <class T> | |
T sto(const std::string & s) | |
{ | |
T t = 0; | |
for (const char c : s) | |
t = t * 10 + c - '0'; | |
return t; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Write a C++ program to simulate Mark Six lottery game. | |
#include <iostream> | |
#include <string> | |
#include <sstream> | |
#include <ctime> | |
using namespace std; | |
int main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BottleShop { | |
private String answer = "a secret"; | |
public int changeEmptyBottlesToDrinks(int emptyBottles) { | |
int drinks; | |
if (emptyBottles == 10) { | |
drinks = 1; | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hk.edu.cityu.ast10106.gp12.inventory.ui; | |
import org.eclipse.jface.viewers.TableViewer; | |
import org.eclipse.jface.viewers.Viewer; | |
import org.eclipse.jface.viewers.ViewerComparator; | |
import org.eclipse.swt.SWT; | |
import org.eclipse.swt.widgets.Table; | |
import org.eclipse.swt.widgets.TableColumn; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LabAssessmentQ1 { | |
public static int[] withoutTen(int[] nums){ | |
int j = 0; | |
for (int i = 0; i < nums.length; i++) { | |
int n = nums[i]; | |
nums[i] = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MockTest { | |
public static int bigDiff(int[] nums) { | |
int max = nums[0]; | |
int min = nums[0]; | |
for (int i = 1; i < nums.length; i++) { | |
int n = nums[i]; |
NewerOlder