1. Compile in VS2017 environment. When using scanf, write scanf as scanf_s and you can input from the keyboard.
When using VS2017, the debug window will flash and you need to write a header file #include <; stdlid.h> , and then in return 0; Before writing system ("pause"); This phenomenon can be avoided. Three, the following is a few classic examples 1. Can receive keyboard characters, if it is lowercase, then output uppercase; If it is uppercase, output lowercase; If it is a number, it is not printed
When using VS2017, the debug window will flash and you need to write a header file #include <; stdlid.h> , and then in return 0; Before writing system ("pause"); This phenomenon can be avoided. Three, the following is a few classic examples 1. Can receive keyboard characters, if it is lowercase, then output uppercase; If it is uppercase, output lowercase; If it is a number, it is not printed
#include <stdio.h>
#include <stdlib.h>
int main()
{
int ch = 0;
while ((ch = getchar()) != EOF)
{
if (ch >= 65 && ch <= 90)
{
ch = ch + 32;
putchar(ch);
}
else if (ch >= 97 && ch <= 122)
{
ch = ch - 32;
putchar(ch);
}
else if (ch >= '0' && ch <= '9')
{
;
}
else
{
putchar(ch);
}
}
system("pause");
return 0;
}
2. For example
Output a diamond
#include<stdio.h>
#include<stdlib.h>
int main()
{
int line = 0;
int i = 0;
scanf_s("%d", &line);
for (i = 0; i < line; i++)
{
int j = 0;
for (j = 0; j < line-1-i ; j++)
{
printf(" ");
}
for (j = 0; j < 2 * i + 1; j++)
{
printf("*");
}
printf("\n");
}
for (i = 0; i < line-1; i++)
{
int j = 0;
for (j = 0; j <=i; j++)
{
printf(" ");
}
for (j = 0; j < (line-1-i)*2 - 1; j++)
{
printf("*");
}
printf("\n");
}
system("pause");
return 0;
}
Read More:
- Common compatibility problems of VS2010 to vs2017 projects
- There are many problems in the use of vs2017
- A series of problems in configuring OpenGL development environment in vs2015
- Some small problems in using vs2017
- Some problems and solutions in learning opengl in vs2017
- There will be row spacing problems in algorithm use in latex. Please use the ‘setstretch {1.35}
- OpenGL development environment configuration [vs2017] + common problems
- Small problems encountered in compiling OpenGL under VS2010
- Common problems of shadow map in OpenGL
- Problems encountered in vs2015 configuration using OpenGL environment
- Summary of problems encountered in compiling and installing vtk7 + vs2013 / 2015 + cmake
- Problems encountered in VS2010 compilation
- Some configuration problems of OpenGL in VS2008
- Problems encountered in configuring OpenGL development environment in vs2015
- Solutions to some problems encountered in programming with vs2017
- Problems in using vs2017
- Write about the problems and solutions when configuring OpenGL in vs2015
- Linux common problems and Solutions
- Record of problems encountered in using vs2017
- Common problems of Hadoop startup error reporting