Skip to content

✨ support compile error msg#16

Merged
crossoverJie merged 8 commits intomainfrom
feature/compile-msg
Sep 25, 2022
Merged

✨ support compile error msg#16
crossoverJie merged 8 commits intomainfrom
feature/compile-msg

Conversation

@crossoverJie
Copy link
Owner

  • Compile message.
  • Recursion function.
  • print()

example: print_triangle.gs

int num(int x,int y){
	if (y==1 || y ==x) {
		return 1;
	}
    int v1 = num(x - 1, y - 1);
    int v2 = num(x - 1, y);
	int c = v1+v2;
    // int c = num(x - 1, y - 1)+num(x - 1, y);
	return c;
}

printTriangle(int row){
	for (int i = 1; i <= row; i++) {
        for (int j = 1; j <= row - i; j++) {
           print(" ");
        }
        for (int j = 1; j <= i; j++) {
            print(num(i, j) + " ");
        }
        println("");
    }
}

printTriangle(7);
      1 
     1 1 
    1 2 1 
   1 3 3 1 
  1 4 6 4 1 
 1 5 10 10 5 1 
1 6 15 20 15 6 1

int num(int x,int y){
	if (y==1 || y ==x) {
		return 1;
	}
    int v1 = num(x - 1, y - 1);
    int v2 = num(x - 1, y);
	int c = v1+v2;
	return c;
}
support recursive function
int c = r(x-1, ret) +r(x-1, ret);
support recursive function
@crossoverJie crossoverJie merged commit afb99fb into main Sep 25, 2022
@crossoverJie crossoverJie deleted the feature/compile-msg branch September 25, 2022 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant