#include <iostream>
#define na 4
int main() {
int a[na];
a[0] = 2;
for (int n = 1; n < na; n++) a[n] = a[n-1] + 1;
This file contains 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<iostream> | |
using namespace std; | |
//大小为4 | |
class A | |
{ | |
public: | |
int a; | |
}; |
This file contains 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 <iostream> | |
using std::cout; | |
using std::endl; | |
class A { | |
public: | |
A(int x): mem_(x){} | |
A& operator=(const A& other) { | |
cout << "copy assignment operator" << endl; | |
mem_ = other.mem_; |
This file contains 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 Singleton{ | |
private: | |
Singleton(); | |
Singleton(const Singleton& other); | |
public: | |
static Singleton* getInstance(); | |
static Singleton* m_instance; | |
}; | |
Singleton::Singleton() {} |
This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
#include <cuda_runtime.h> | |
//http://www.techdarting.com/2014/03/matrix-multiplication-in-cuda-using.html | |
// This code assumes that your device support block size of 1024 | |
#define MAX_RANGE 9999 |
This file contains 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
import sys,os | |
import curses | |
def draw_menu(stdscr): | |
k = 0 | |
cursor_x = 0 | |
cursor_y = 0 | |
# Clear and refresh the screen for a blank canvas | |
stdscr.clear() |
This file contains 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
#!/bin/bash | |
#------------------------------------------------------------------------------ | |
# Name: sbtmkdirs | |
# Version: 1.5 | |
# Purpose: Create an SBT project directory structure with a few simple options. | |
# Author: Alvin Alexander, http://alvinalexander.com | |
# License: Creative Commons Attribution-ShareAlike 2.5 Generic | |
# http://creativecommons.org/licenses/by-sa/2.5/ | |
#------------------------------------------------------------------------------ |
This file contains 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
this page intentionally left blank |
Software Development for Scientists and Engineers
Recall how the stream insertion operator>> behaves: it returns a reference to the remaining stream after reading a unit of data from the stream
inspired by Madcola