Linux下用C++实现俄罗斯方块

本文实例为大家分享了C++实现俄罗斯方块游戏代码,供大家参考,具体内容如下

1.block.c

#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <stdlib.h>
#include <setjmp.h>
#include <sys/time.h>
#include <string.h>
#include "block.h"

//init for globle
void
init_for_globle(void)
{
  x = X / 2 - 2;   // the first diamond appear postion
  flag_erase = 1;
  srand(getpid());  //srand
  num = rand() % 7;  // random appear first diamond
  mode = rand() % 4; // random appear first diamond mode
  color = rand() % 7 + 41;  // random first diamond color

  next_num = rand() % 7;
  next_mode = rand() % 4;
  save_color = rand() % 7 + 41;

  print_start_interface();  // print game start interface
// print_score();   // print init score 0
// print_level();   // print init level 1
}

//print start interface
void
print_start_interface(void)
{
  int x, y;
  printf("\33[2J");
  printf("\33[%d;%dH\33[32m分数:\33[0m", p_y + 10, p_x + 25);
  printf("\33[%d;%dH\33[32m等级:\33[0m", p_y + 14, p_x + 25);
  for (x = p_x, y = p_y; x <= 46; x++)
    printf("\33[%d;%dH\33[41m==\33[0m", y, x);
  for (x = p_x, y = p_y + 1; y <= 25; y++)
    printf("\33[%d;%dH\33[41m||\33[0m", y, x);
  for (x = p_x + 22, y = p_y + 1; y <= 25; y++)
    printf("\33[%d;%dH\33[41m||\33[0m", y, x);
  for (x = p_x + 36, y = p_y + 1; y <= 25; y++)
    printf("\33[%d;%dH\33[41m||\33[0m", y, x);
  for (x = p_x + 24, y = p_y + 8; x <= 44; x++)
    printf("\33[%d;%dH\33[41m--\33[0m", y, x);
  for (x = p_x, y = p_y + 21; x <= 46; x++)
    printf("\33[%d;%dH\33[41m==\33[0m", y, x);
  printf("\33[?25l");
  fflush(stdout);
}

//erase last diamonds
void
erase_last(void)
{
  int j, x1, y1, n;
  x1 = save_x + p_x + 2;
  for (j = 0, n = 0; j < 16; j++) {
    if (j / 4 >= shape[num][save_mode][16] && j % 4 == 0) {
      y1 = save_y + p_y + 1 + n;
      printf("\33[%d;%dH", y1, x1);
      n++;
    }
    if (j / 4 >= shape[num][save_mode][16]
      && j % 4 >= shape[num][save_mode][17]) {
      if (shape[num][save_mode][j] == 0) {
        printf("\33[2C");
      }
      if (shape[num][save_mode][j] == 1) {
        printf(" ");
      }
    }
  }
  fflush(stdout);
}

//print modes shape
void
print_mode_shape(void)
{
  int j, x1, y1, n;
  int left_flag = 0;
  if (flag_erase == 0) {
    erase_last();
  }
  x1 = x + p_x + 2;
  for (j = 0, n = 0; j < 16; j++) {
    if (j / 4 >= shape[num][mode][16] && j % 4 == 0) {
      y1 = y + p_y + 1 + n;
      printf("\33[%d;%dH", y1, x1);
      n++;
    }
    if (j / 4 >= shape[num][mode][16]
      && j % 4 >= shape[num][mode][17]) {
      if (shape[num][mode][j] == 0) {
        printf("\33[2C");
      }
      if (shape[num][mode][j] == 1) {
        printf("\33[%dm[]\33[0m", color);
      }
    }
    fflush(stdout);
  }
  printf("\33[0m");
  fflush(stdout);
  save_x = x;
  save_y = y;
  save_mode = mode;
  save_row = 4 - shape[num][mode][16];
  save_col = 4 - shape[num][mode][17];
  flag_erase = 0;

}

//store diamonds to matrix by color to flag
void
store_flag_color(void)
{
  int i, a = 0, b = 0;
  for (i = 0; i < 16; i++) {
    if (i / 4 >= shape[num][mode][16] && i % 4 == 0) {
      a++;
      b = 0;
    }
    if (i / 4 >= shape[num][mode][16]
      && i % 4 >= shape[num][mode][17]) {
      if (shape[num][save_mode][i] == 0) {
        b = b + 2;
      }
      if (shape[num][save_mode][i] == 1) {
        matirx[save_y + a - 1][save_x + b] = color;
        b++;
        matirx[save_y + a - 1][save_x + b] = color;
        b++;
      }
    }
  }
}

//print the save matrix
void
print_save_matrix(void)
{
  int i, j, n = 0;
  for (i = 0; i < Y; i++) {
    printf("\33[%d;%dH", i + p_y + 1, p_x + 2);
    for (j = 0; j < X; j++) {
      if (matirx[i][j] != 0) {
        n = (n + 1) % 2;
        fprintf(stdout, "\33[%dm", matirx[i][j]);
        (n == 1) ? printf("[") : printf("]");
      }
      if (matirx[i][j] == 0) {
        printf("\33[0m");
        printf(" ");
      }
      fflush(stdout);
    }
  }
}

// change shape
void
change_shape(void)
{
  int i, n;
  for (i = 0; i < save_row; i++) {
    if (num == 6) {
      n = 4;
    } else {
      n = 0;
    }
    if (((x + n) >= X - save_col * 2 && save_col < save_row) ||
      judge_by_color(x, (mode + 1) % 4) == 1) {
      return;
    }
  }
  mode = (mode + 1) % 4;
  fflush(stdout);
  print_mode_shape();
  fflush(stdout);
}

//move right
void
move_right(void)
{
  int i;
  if (x >= X - save_col * 2 || judge_by_color(x + 2, mode) == 1) {
    return;
  }
  x = x + 2;
  print_mode_shape();
  fflush(stdout);
}

// move left
void
move_left(void)
{
  int i;
  if (x <= 0 || judge_by_color(x - 2, mode) == 1) {
    return;
  }
  x = x - 2;
  print_mode_shape();
  fflush(stdout);
}

// move down
void
move_down()
{
  y++;
  if (y >= Y - save_row + 1 || judge_by_color(x, mode) == 1) {
    store_flag_color();
    game_over();
    y = 0;
    save_row = 0;
    save_col = 0;
    x = X / 2 - 2;

    num = next_num;
    mode = next_mode;
    color = save_color;
    next_num = random() % 7;
    next_mode = random() % 4;
    save_color = random() % 7 + 41;
    print_next();
    flag_erase = 1;
    destroy_line();
    fflush(stdout);
    return;
  }
  print_mode_shape();
  fflush(stdout);
}

void
fall_down()
{
  while (1) {
    y++;
    if (y >= Y - save_row + 1 || judge_by_color(x, mode) == 1) {
      store_flag_color();
      game_over();
      y = 0;
      save_row = 0;
      save_col = 0;
      x = X / 2 - 2;

      num = next_num;
      mode = next_mode;
      color = save_color;
      next_num = rand() % 7;
      next_mode = rand() % 4;
      save_color = rand() % 7 + 41;
      print_next();
      flag_erase = 1;
      destroy_line();
      fflush(stdout);
      return;
    }
    print_mode_shape();
    fflush(stdout);
  }

}

//erase next tip diamond
void
erase_next(void)
{
  int i, j, n = 0;
  for (i = 0; i < 4; i++) {
    printf("\33[%d;%dH", p_y + 3 + n, p_x + X + 7);
    n++;
    for (j = 0; j < 4; j++) {
      printf(" ");
    }
  }
  printf("\33[30;4H\33[?25l");
  fflush(stdout);
}

//print next tip diamond
void
print_next(void)
{
  int j, n = 0;
  erase_next();
  for (j = 0; j < 16; j++) {
    if (j / 4 >= shape[next_num][next_mode][16] && j % 4 == 0) {
      printf("\33[%d;%dH", p_y + 3 + n, p_x + X + 7);
      n++;
    }
    if (j / 4 >= shape[next_num][next_mode][16]
      && j % 4 >= shape[next_num][next_mode][17]) {
      if (shape[next_num][next_mode] == 0) {
        printf("\33[2C");
      }
      if (shape[next_num][next_mode][j] == 1) {
        printf("\33[%dm[]\33[0m", save_color);
      }
    }
  }
}

//print scores info
void
print_score(void)
{
  printf("\33[%d;%dH\33[31m%d\33[0m", p_y + 10, p_x + X + 10, score);
  fprintf(stdout, "\33[%d;0H", p_y + 20 + 2);
}

//print grades info
void
print_level(void)
{
  printf("\33[%d;%dH\33[31m%d\33[0m", p_y + 14, p_x + X + 10, level);
  fprintf(stdout, "\33[%d;0H", p_y + 20 + 2);
}

//destroy a line or lines
void
destroy_line(void)
{
  int i, j, full;
  int a, b, c;
  for (i = 0; i < Y; i++) {
    full = 1;
    for (j = 0; j < X; j++) {
      if (matirx[i][j] == 0) {
        full = 0;
      }
    }
    if (full == 1) {
      for (a = 0; a < i; a++) {
        for (b = 0; b < X; b++) {
          matirx[i - a][b] = matirx[i - a - 1][b];
        }
      }
      print_save_matrix();
      score = score + 100;
      if (score % LEVEL_SCORE == 0) {
        level = level + 1;
        if (level >= 9)
          level = 9;
        change_level();
        print_level();

      }
      print_score();
    }
  }
}

//change level , change rate
void
change_level(void)
{
  switch (level) {
  case 1:
    setitimer(ITIMER_REAL, &level_01, NULL);
    break;
  case 2:
    setitimer(ITIMER_REAL, &level_02, NULL);
    break;
  case 3:
    setitimer(ITIMER_REAL, &level_03, NULL);
    break;
  case 4:
    setitimer(ITIMER_REAL, &level_04, NULL);
    break;
  case 5:
    setitimer(ITIMER_REAL, &level_05, NULL);
    break;
  case 6:
    setitimer(ITIMER_REAL, &level_06, NULL);
    break;
  case 7:
    setitimer(ITIMER_REAL, &level_07, NULL);
    break;
  case 8:
    setitimer(ITIMER_REAL, &level_08, NULL);
    break;
  case 9:
    setitimer(ITIMER_REAL, &level_09, NULL);
    break;
  default:
    break;
  }
}

//by the color to judge whether went across or not
int
judge_by_color(int x, int mode)
{
  int i, a = 0, b = 0;
  for (i = 0; i < 16; i++) {
    if (i / 4 >= shape[num][mode][16] && i % 4 == 0) {
      a++;
      b = 0;
    }
    if (i / 4 >= shape[num][mode][16]
      && i % 4 >= shape[num][mode][17]) {
      if (shape[num][mode][i] == 0) {
        b = b + 2;
      }
      if (shape[num][mode][i] == 1) {
        if (matirx[a + y - 1][b + x] != 0) {
          return 1;
        } else
          b = b + 2;
      }
    }

  }
}

//control the diamonds shape by the key
void
key_control(void)
{
  int ch, flag = 1;
  struct termios save, raw;

  tcgetattr(0, &save);
  cfmakeraw(&raw);
  tcsetattr(0, 0, &raw);
  if (setjmp(env) == 0) {
    while (flag) {
      ch = getchar();
      if (ch == '\r') {
        fall_down();
      }
      if (ch == '\33') {
        ch = getchar();
        if (ch == '[') {
          ch = getchar();
          switch (ch) {
          case 'A':
            change_shape();
            break;
          case 'B':
            move_down();
            break;
          case 'C':
            move_right();
            break;
          case 'D':
            move_left();
            break;
          }
        }
      }

      if (ch == 'q' || ch == 'Q') {
        flag = 0;
      }
    }
    printf("\33[%d;%dH\33[31m-----game interrupt exit!-----\33[0m",
        p_y + Y + 3, p_x);
    printf("\33[%d;0H\33[?25h", p_y + Y + 4);
  }
  tcsetattr(0, 0, &save);
}

//reach the top line, the game is over
void
game_over(void)
{
  int i;
  for (i = 0; i < X; i++) {
    if (matirx[1][i] != 0) {
      printf
        ("\33[31m\33[%d;%dH-------game over!--------\33[0m",
         p_y + Y + 3, p_x);
      printf("\33[0m\33[?25h\33[%d;0H", p_y + Y + 4);
      longjmp(env, 2);
    }
  }
}

2.block.h

#ifndef _BLOCK_H_
#define _BLOCK_H_

#define p_x 10      //init postion row;
#define p_y 5      //init postion col;
#define X 20          // game_window_size
#define Y 20
#define LEVEL_SCORE 500     // need scores to upgrade

jmp_buf env;
static int x, y;                   //  current diamonds postion
static int flag_erase;                  //  erase flag
static int num, mode, next_num, next_mode;        //  current and next diamonds
static int save_row, save_col, save_x, save_y, save_mode;//  save coordinate, save graph
static int color, save_color, flag_color;           //  save the color of the next diamonds
static int matirx[Y][X] = { 0 };             //  save diamonds' matrix
static int level = 1;                   //  game levels
static int score = 0;           //  game scores

typedef struct itimerval LEVEL;
static LEVEL level_00 = { {0,   0}, {0,   0} };
static LEVEL level_01 = { {0, 800000}, {1,   0} };
static LEVEL level_02 = { {0, 500000}, {0, 500000} };
static LEVEL level_03 = { {0, 400000}, {0, 300000} };
static LEVEL level_04 = { {0, 300000}, {0, 300000} };
static LEVEL level_05 = { {0, 200000}, {0, 300000} };
static LEVEL level_06 = { {0, 150000}, {0, 300000} };
static LEVEL level_07 = { {0, 100000}, {0, 300000} };
static LEVEL level_08 = { {0, 80000 }, {0, 300000} };
static LEVEL level_09 = { {0, 60000 }, {0, 300000} };

//three-dimensional for saving diamonds and diamonds' shape :
//first-dimensional for kind of diamonds-shape
//second-dimensional for alterable's mode
//third-dimensional for reality value of row and col
static const int shape[7][4][18] = {
               {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1,   2, 1},  //
                {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0,   1, 2},  //  []  []  [][][]   []
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0,   2, 1},  // [][][] [][]  []   [][]
                {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1,   1, 2}}, //     []        []

               {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1,   2, 1},  //
                {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1,   1, 2}, //     []      [][]
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0,   2, 1},  //   [] []  [][][]  []
                {0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1,   1, 2}},  // [][][] [][] []    []

               {{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1,   1, 2},  //
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1,   2, 1},  //     [][]      []
                {0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0,   1, 2},  // []    []  [][][]  []
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,   2, 1}}, // [][][]  []    [] [][]

               {{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1,   1, 2},  //
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0,   2, 1},  //  []
                {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1,   1, 2},  //  [][]   [][]
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0,   2, 1}}, //    []  [][]

               {{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0,   1, 2},  //
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1,   2, 1},  //   []
                {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0,   1, 2},  //  [][]  [][]
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1,   2, 1}}, //  []    [][]

               {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1,   2, 2},  //
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1,   2, 2},  //
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1,   2, 2},  //   [][]
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1,   2, 2}}, //   [][]

               {{0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,   0, 3},  //   []
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,   3, 0},  //   []   [][][][]
                {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,   0, 3},  //   []
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,   3, 0}}  //   []
               };

void init_for_globle(void);
void print_start_interface(void);
void print_mode_shape(void);
void print_save_matrix(void);
void change_shape(void);
void move_left(void);
void move_right(void);
void move_down();
void fall_down();
void store_flag_color(void);
void key_control(void);
void erase_last(void);
void destroy_line(void);
void print_next(void);
void erase_next(void);
void change_level(void);
void print_score(void);
void print_level(void);
int judge_by_color(int x, int mode);
void game_over(void);

#endif

3.main.c

#include <stdio.h>
#include <signal.h>
#include <sys/time.h>
#include <setjmp.h>
#include "block.h"

int
main(int argc, char **argv)
{
  init_for_globle(); //init for globle
  print_mode_shape(); //print first diamond
  print_next();    //print next diamond
  setitimer(ITIMER_REAL, &level_01, NULL);  //init one leve ;interval 800ms
  signal(SIGALRM, move_down); //diamond down base on the interval time
  key_control();   //using zhe key to play games

  return 0;
}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

(0)

相关推荐

  • C++俄罗斯方块游戏 无需图形库的俄罗斯方块

    本文实例为大家分享了C++俄罗斯方块游戏的具体实现代码,供大家参考,具体内容如下. #include<stdio.h> #include<stdlib.h> #include<windows.h> #include<time.h> #include<conio.h> #define MOD 28 #define SIZE_N 19 #define SIZE_M 12 int cur_x,cur_y; int score,mark,next,map

  • C++制作俄罗斯方块

    缘起: 在玩Codeblocks自带的俄罗斯方块时觉得不错,然而有时间限制.所以想自己再写一个. 程序效果: 主要内容: 程序中有一个board数组,其中有要显示的部分,也有不显示的部分,不显示的部分都存储1. 如下图: shape采用4*4数组(shape)保存.如: 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 0 另外用变量row和column保存shape数组左上角在board中的位置. 每次下落或左右移动,先对row和column做出改变,然后检测当前row和column

  • C语言实现俄罗斯方块小游戏

    C语言实现俄罗斯方块小游戏的制作代码,具体内容如下 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define TTY_PATH "/dev/tty" #define STTY_ON "stty raw -echo -F" #define STTY_OFF "stty -raw echo -F" int map[21][14]; char

  • Linux下用C++实现俄罗斯方块

    本文实例为大家分享了C++实现俄罗斯方块游戏代码,供大家参考,具体内容如下 1.block.c #include <stdio.h> #include <termios.h> #include <unistd.h> #include <stdlib.h> #include <setjmp.h> #include <sys/time.h> #include <string.h> #include "block.h&

  • 解决linux下openoffice word文件转PDF中文乱码的问题

    网上很多介绍是由于jdk中的没有字体导致乱码,而我遇到的是转换过程并未报错,但转换后的PDF中是乱码,尝试在jre/lib/fonts/中增加字体,还是不能解决问题,因此可以判断非jre字体问题,是linux系统字体问题. 用vim /etc/fonts/fonts.conf,可以看到系统字体文件在/usr/share/fonts,将windows系统字体文件连接到此目录下 ln -s /usr/local/fonts fonts 然后更新缓存:fc-cache 重启openoffice: /o

  • linux下的通配符与正则表达式

    通配符 *  任意字符,可重复多次     ? 任意字符,重复一次     [] 代表一个字符 举例: [a,b,c] 表示abc中任意一个 通配符的作用是用来匹配文件名的 正则表达式 正则表达式是在文件中匹配符合条件的字符串的 ls find cp是不支持正则表达式的 但是grep awk sed支持正则表达式 [root@hadoop-bigdata01 test]# touch aa [root@hadoop-bigdata01 test]# touch aab aabb [root@ha

  • Linux下安装MongoDB的实现步骤

    Linux下安装MongoDB的实现步骤 Mongo DB 是目前在IT行业非常流行的一种非关系型数据库(NoSql),其灵活的数据存储方式备受当前IT从业人员的青睐.Mongo DB很好的实现了面向对象的思想(OO思想),在Mongo DB中 每一条记录都是一个Document对象.Mongo DB最大的优势在于所有的数据持久操作都无需开发人员手动编写SQL语句,直接调用方法就可以轻松的实现CRUD操作.本文介绍了如何快速安装mongodb供大家参考. 一.安装配置mongodb Step 1

  • Linux下nginx生成日志自动切割的实现方法

    Linux下nginx生成日志自动切割的实现方法 1.编辑切割日志的 shell 程序,目录自定 #vi /data/nginx/cut_nginx_log.sh 输入代码: #!/bin/bash # This script run at 00:00 function cutAccess() { dir=$1 newdir="${dir}/$(date -d "yesterday" +"%Y")/$(date -d "yesterday&quo

  • Linux下安装或升级Python 2.7的操作方法

    1.准备编译环境gcc 2.去官网下载要安装的对应版本的python的源代码 下载地址:https://www.python.org/downloads/source/ 你可以选择你要下载的版本,用wget指令来下载相应的源代码 3.解压下载的代码包 tar -zxvf Python-x.x.x.tgz cd Python-x.x.x 4.配置 1)查找configure文件 find . -name configure cd 搜索结果(一般就在Python文件根目录下) 2)进行配置 ./co

  • Linux下.tar.xz文件的解压教程详解

    前言 对于xz这个压缩相信很多人陌生,但xz是绝大数linux默认就带的一个压缩工具,xz格式比7z还要小. 最近在下载某个源码包的时候遇到的这种压缩格式,乘此机会分享一下xz的压缩与解压方法. 安装 如果系统没有xz命令,需要进行安装,安装方法非常简单, 在centos下,直接运行: yum install xz 也可以使用源码包安装: 先下载该工具源码包http://tukaani.org/xz/ 下载后解压进入该目录运行configure生成makefile文件用-prefix指定安装目录

  • Linux下修改Oracle监听地址的方法

    lisenter.ora 目录在 /opt/oracle/11g/network/admin LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.111.123)(PORT = 1521)) ) ) ADR_BASE_LISTENER = /opt/oracle tnsnames.o

  • Linux下Oracle删除用户和表空间的方法

    本文实例讲述了Linux下Oracle删除用户和表空间的方法.分享给大家供大家参考,具体如下: 1.删除某个用户 SQL> conn /as sysdba Connected. SQL> drop user userName cascade; 用户已删除 如果用户无法删除,并报错: ERROR at line 1: ORA-01940: cannot drop a user that is currently connected 通过查看用户的进行,并kill用户进程,然后删除用户. SQL&

  • Linux下VMware workstation的3种使用技巧

    很多人都说虚拟机不易管理,原因是我们对于虚拟化的使用技巧掌握的还不是很好.今天,我们就来看三个Linux下的VMware workstation使用技巧. VMware workstation使用技巧一.实现VMWare桥接无线网卡上网,不再只限于用NAT 环境:宿主机为UBUNTU8.04_amd64,VMware workstation 6.0.x 在UBUNTU下(实际上是在LINUX作宿主机的情况下)使用VMWare一直有两个大家公认的问题:一是声卡占用的问题:二是桥接无线网卡的问题.关

随机推荐