Full dry goods! Full dry goods! (Boredom notes from a beginner who has just started a program)

  Hello, I am an old and decadent, a new student in a software institute. This is my first blog, probably written for a passive reason, but it is also a starting point for my career as a programmer ape. The next section is about some of the problems I encountered when I first learned c and some sharing on learning it. (PS: This is very dry, we recommend reading with drinks)

  Everyone has that three minutes of heat. So on the afternoon of the first day of school, a person sneaked into the library while all his roommates were napping. I took out a copy of "c Language From Getting Started to Proficiency" from the bookshelf on the left side of the second floor, found a seat, and looked up with great pleasure. I looked for a moment, took out my mobile phone, knocked down the first code in my life, I believe many friends have knocked, that is, "hello world". I looked at the line of text on the screen and thought, "Hey, that's the same."

    Later, through their own study on station b and the teacher's explanation in class. I started to learn more about the c language course. There are also many difficulties in the learning process. I am following the textbook and learning along with the courses on station b. The first chapter deals with the data types, operators and expressions of the c language. Maybe many school teachers skip this chapter and don't talk about what the latter interrupts when they explain what follows. This will also bring a problem, that is, when students programming their own use of symbols is always not standard, do not know the operation rules in the c language, do not know the combination and priority of operators, and so on... This will also have a great impact on the accuracy and fluency of our programming. So I suggest that students should have a complete look at this chapter and review it from time to time.

        During this period, I was stuck by a test assignment (later I knew it was the simplest c language game)

        Because I didn't learn for's looping statement at that time and didn't know how to use the "rand" function mentioned in the question, this topic has been bothering me for a long time. "Forced" again, I completed the selection statement and the use of for on station b. Finally, I completed this topic with the help of the same senior in a night of self-study.

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int menu()
{
	printf("**********************\n");
	printf("******1.Game begins*******\n");
	printf("******0.Game over******\n");
	printf("*********************\n");
}
void games()
{
	int ret,guess;
	ret=rand()%100+1;
	
	for(;;)
	{
		printf("Please enter a number you guessed\n");
		scanf("%d",&guess);
		
		if(ret<guess)
		{
			printf("Your guess is too big\n");
		}
	 else if(ret>guess)
	 {
	 	printf("Your guess is low\n");
	 }
	 else
	 {
	 	printf("Congratulations on your correct answer\n");
	 	break;
	 }
	 } 
}
int main()
{
	int n;
	srand((int)time(NULL));
	
//	do
	menu();
printf("Please enter your choice:\n");
	scanf("%d",&n);
	
	switch(n)
	{
		case 1:
			games();
			break;
			case 0:
				printf("End Game\n");
				break;
				default:
					printf("You guessed wrong, please re-enter\n");
					break;
					
}
return 0;
}


  In the last few days, due to the bad math, I have been remediating high numbers and learning the c language has slowed down. Two Examination Questions Published by Competition Department of Innovation and Entrepreneurship Center for College Students

  For the second question, it is not a problem because it was written as early as the beginning of the school and you know how to judge it. But the first question, how to print such a kind of love using the for loop statement, has been for a long time. At first, I wanted to think about it as a whole, but I didn't know how to do it because the top and bottom parts of it'*'had different rules of increase and decrease. Later, I tried to print it as three parts, two trapezoids in the first three lines, because the top part had its'* "The law of increase and decrease is the same. Go to the rectangle in the middle of three rows and the triangle in the rest. This prints the love out.

#include<stdio.h>
int menu()
{
	printf("**********************\n");
	printf(":Are you ready? Children\n");
	printf("1.Captain is ready\n ");
	printf("0.Captain, I need to think again\n");
	printf("**********************\n");
}

int game()
{
	int i,j,n=3;//i is the number of lines and j is the number of symbols per line! 
	for(i=0;i<n;i++)
	{
		for(j=0;j<5-2*i;j++)
		{
			printf(" ");
		}
		for(j=0;j<6+4*i;j++)
		{
			printf("*");
		}
		for(j=0;j<9-4*i;j++)
		{
			printf(" ");
			
		}
		for(j=0;j<6+4*i;j++)
		{
			printf("*");
		}
		printf("\n");
}
   for(i=0;i<3;i++)
   {
   	for(j=0;j<31;j++)
   	{
   		printf("*");
	   }
	   printf("\n");
   }
   for(i=0;i<8;i++)
   {
   	for(j=0;j<2*i+1;j++)
   	{
   		printf(" ");
	   }
	   for(j=0;j<29-4*i;j++)
	   {
	   	printf("*");
	   }
	   printf("\n");
	   
	   }
	   return 0;
   }
   int main()
  {
   	int a;
    	menu();
   	printf("Please enter your choice:\n");
 	   scanf("%d",&a);
 	   switch(a) 
	   {
	   	case 1:game();break;
	   	case 0:
	   		printf("Captain, I need to think again\n"); 
   }
	   return 0; 
  }
   
   
   

	
		
	

  "Are you ready, children"

"Captain ready"

    Today is 10.24, a special programmer's holiday, so here I wish all apes and programmers a happy holiday.

(Newbies, don't spray.)

 

 

 

 

 

 

 

 

 

 

  

Added by phpnewbie81 on Sun, 24 Oct 2021 19:42:48 +0300