-
I don't know exactly what the other two friends mean, but it seems that they are all based on the flow of discussions.
I don't think it's that complicated.
Because the landlord wrote this when defining the global variables:
int a[1000],f[1000],g[1000];
From these sentences of the main function:
cin>>n;
for (int i=1;i<=n;i++)cin>>a[i];
The first input is 1000, then it is the value assigned to n, n=1000, according to the above **, the program has generated out-of-bounds access. (n=1000)
As far as the existing procedures are concerned, as long as they are in.
cin>>a[i];
The statement does not produce out-of-bounds access, and the following programs should not have out-of-bounds access errors.
It depends on the landlord's idea, not to use dynamic arrays or stls.
So, the problem here is simple, the initialization array size is not large enough.
Just change it this way:
#define max (1 <<16)
int a[max],f[max],g[max];
-
The C language itself does not have the input and output statements correct. In the C language, there are no input and output statements, and the reading and writing of files are implemented by library functions. The continue statement is only used in while and for loops, and the function is to skip the remaining statements in the loop body and force the next loop, and continue to solve the loop condition for while loops.
Demo model: Huawei MateBook X System version: Win10 The C language itself does not have the correct input and output statements.
In the C language, there are no input and output statements, and the reading and writing of files are implemented by library functions. The continue statement is only used in while and for loops, and the function is to skip the remaining statements in the loop body and force the next loop, and continue to solve the loop condition for while loops.
Tips for using the computer:
2. Restore a webpage that was accidentally closed: Press the Ctrlshiftt key at the same time to quickly restore the current webpage.
3. Program switching: When there are too many tasks to process, it is often necessary to click the mouse frequently to switch programs, and you can press Windowstab to achieve 3D switching effect.
4. Windows Screenshot Tool: Press Win+R key to bring up the run menu, enter SnippingTool, and you can open the Snipping Tool.
5. The keyboard fails to bring up the virtual keyboard: Win + R keys Enter the OSK, the virtual keyboard will appear on the screen and synchronize with the physical keyboard.
-
When you enter this program, you should pay attention to the fact that when you enter your current program, you can't have a space in the middle: 10+11 Enter.
If you want to enter with a space, you need to change the program, when typing, you can have a space in the middle: 10 + 11 enter.
There's a space here.
-
The input format is Numeric Symbol Numeric Value.
There must be no white space between the first two numeric symbols, and the latter can be either white space or not.
Input example: 11+22 carriage return.
11-space-12 carriage enter.
11+12 carriage enter.
11-space-12 carriage enter.
The symbol only allows +- and no commas.
- The latter sentence scanf s("%f",&a);You can use system( instead"pause");
-
Enter 10+11 Enter.
That's it. The scanf s statement at the end of the function is deleted.
Do it by your train of thought.
Method 1. string strnumber="200m"; >>>More
You can delete the Microsoft input method first,And then add it again,So that Microsoft will come to the front,You press ctrl+space to directly Microsoft input method。
#include
using namespace std; >>>More
Scope. You static char *chh;
static char *ch1;Although the address pointed to by the two pointers does not change, have you ever wondered whether the memory address they point to has been released, char chc[10]; It's local, the function is out, the lifecycle is over, and you're trying to access it with a pointer in void times(). >>>More
The output of this program is: 4
You can standardize the program to make it easier to understand. >>>More