当前位置:网站首页>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;
}边栏推荐
- Anomalies seen during the interview
- P1656 bombing Railway
- 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
- Speed up the energy Internet of things. What can low-power Internet of things technology represented by Zeta do?
- Struct in linked list
- ISBN number
- 打印菱形图案
- Analysis: misunderstanding of choosing WMS warehouse management system
- Network layer - routing
- Global and Chinese markets of distributed control system (DCS) consumption 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢
![[common error] custom IP instantiation error](/img/de/d3f90cd224274d87fcf153bb9244d7.jpg)
[common error] custom IP instantiation error

Similarities and differences of text similarity between Jaccard and cosine

Interview script of Software Test Engineer

Reading notes on how programs run

What is the GPM scheduler for go?

A method to solve Bert long text matching

It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction

功能:求5行5列矩阵的主、副对角线上元素之和。注意, 两条对角线相交的元素只加一次。例如:主函数中给出的矩阵的两条对角线的和为45。

Recommendation of knowledge base management system

Sequence list and linked list
随机推荐
删除所有值为y的元素。数组元素中的值和y的值由主函数通过键盘输入。
Severity code description the project file line prohibits the display of status error c4996 fopen ('fscanf ', StrCmp): this function or variable may be unsafe The most comprehensive solution
What is regression testing? Talk about regression testing in the eyes of Ali Test Engineers
swagger中响应参数为Boolean或是integer如何设置响应描述信息
A dichotomy of Valentine's Day
[NLP] text classification still stays at Bert? Duality is too strong than learning framework
Sequence list and linked list
Suggestions for improving code quality
Generic
Five high-frequency questions were selected from the 200 questions raised by 3000 test engineers
机器学习基础:用 Lasso 做特征选择
[common error] custom IP instantiation error
ITK learning notes (VII) the position of ITK rotation direction remains unchanged
Sorry, Tencent I also refused
MySQL 8.0.12 error: error 2013 (HY000): lost connection to MySQL server during query
The difference between objects and objects
PMP 考试常见工具与技术点总结
Network layer - routing
Pair
OS interrupt mechanism and interrupt handler