当前位置:网站首页>Delete all elements with a value of Y. The values of array elements and y are entered by the main function through the keyboard.
Delete all elements with a value of Y. The values of array elements and y are entered by the main function through the keyboard.
2022-07-04 00:41:00 【CTGU-Yoghurt】
subject :
Delete all values as y The elements of . The sum of the values in the array elements y The value of is determined by
The main function inputs... Through the keyboard .
Code details :
#include <stdio.h>
#include<conio.h>
#include<stdio.h>
#define M 20
void fun(int bb[], int* n, int y)
{
/**********Program**********/
for (int i = 0; i < *n;)
{
if (bb[i] == y) {
for (int j = i; j < *n; j++)
{
bb[j] = bb[j + 1];
}
(* n)--;// notes :-- The priority is * In front of , So expand with parentheses
}
else i++;
}
/********** End **********/
}
int main()
{
int aa[M], n, y, k;
printf("\nPlease enter n:"); scanf("%d", &n);
printf("\nEnter %d positive number:\n", n);
for (k = 0; k < n; k++) scanf("%d", &aa[k]);
printf("The original data is:\n");
for (k = 0; k < n; k++) printf("%5d", aa[k]);
printf("\nEnter a number to deletede:"); scanf("%d", &y);
fun(aa, &n, y);
printf("The data after deleted %d:\n", y);
for (k = 0; k < n; k++) printf("%4d", aa[k]);
printf("\n");
return 0;
}
边栏推荐
- Global and Chinese market of melting furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
- 不得不会的Oracle数据库知识点(三)
- Data storage - interview questions
- Optimization of for loop
- 查询效率提升10倍!3种优化方案,帮你解决MySQL深分页问题
- Analysis and solution of lazyinitializationexception
- How to trade spot gold safely?
- 【leetcode】300. Longest increasing subsequence (dynamic programming, dichotomy)
- Speed up the energy Internet of things. What can low-power Internet of things technology represented by Zeta do?
- Alibaba test engineer with an annual salary of 500000 shares notes: a complete set of written tests of software testing
猜你喜欢
NLP pre training technology development
It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
What is the potential of pocket network, which is favored by well-known investors?
[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept
P3371 [template] single source shortest path (weakened version)
The difference between objects and objects
Private project practice sharing populate joint query in mongoose makes the template unable to render - solve the error message: syntaxerror: unexpected token r in JSON at
OS interrupt mechanism and interrupt handler
[common error] UART cannot receive data error
@EnableAsync @Async
随机推荐
The super fully automated test learning materials sorted out after a long talk with a Tencent eight year old test all night! (full of dry goods
Recommendation of knowledge base management system
Global and Chinese market of melting furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
What is the future of software testing industry? Listen to the test veterans' answers
OS interrupt mechanism and interrupt handler
Global and Chinese market of glossometer 2022-2028: Research Report on technology, participants, trends, market size and share
[software testing] you haven't mastered these real interview questions of big companies?
[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)
Speed up the energy Internet of things. What can low-power Internet of things technology represented by Zeta do?
[PHP basics] cookie basics, application case code and attack and defense
Release and visualization of related data
[error record] configure NDK header file path in Visual Studio
Social network analysis -social network analysis
What are the application fields of digital twins in industry?
STM32 key light
(Video + graphics and text) introduction to machine learning series - Chapter 4 naive Bayes
Sorry, Tencent I also refused
P1629 postman delivering letter
ITK learning notes (VII) the position of ITK rotation direction remains unchanged
How to use AHAS to ensure the stability of Web services?