题目是这样的:Useasingle-subscriptedarraytosolvethefollowingproblem.Readin20numbers,eachofwhichisbetween10and100,inclusive.Aseachnumberisread,printitonlyifitisnotaduplica...

题目是这样的:Use a single-subscripted array to solve the following problem. Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, print it only if it is not a duplicate of a number already read. Prepare for the “worst case” in which all 20 numbers are different. Use the smallest possible array to solve this problem.

我的问题是:怎样检验输入的数与以前输入过的数是否相同呢?用什么方法呢?

int main()

{

int nums[20];

int i;

printf("If the first number you type is not a right number, it will output the number 0.\n");

for(i=0;i<20;i++)

{ int counter=1;

printf("Please type in a number within the interval [10,100]:\n");

scanf("%d",&nums[i]);

rule=nums[0];

if(i==0)

printf("The number you have just typed is %d\n",nums[i]<100&&nums[i]>10?nums[i]:0);

else if(nums[i]<100&&nums[i]>10&&i!=0)

printf("The number you have just typed is %d\n",nums[i]);

else if (nums[i]>=100||nums[i]<=10)

printf(" The number you huve just typed is a wrong number.\n");

}

return 0;

}

展开

c语言subscripted_c语言。数组的问题。急!相关推荐

  1. c语言subscripted_C语言里的 [Warning] assignment from incompatible pointer type 是什么意思啊...

    展开全部 指针类型的赋值. 不同的编译器,e68a843231313335323631343130323136353331333431356566对于不同类型间的指针变量进行赋值的编译检查是不一样的, ...

  2. c语言一维数组求平均成绩,C语言 计算一维数组平均值(函数).doc

    酒谆亥布福墅瞒筹崖锈促担粟靡鳖啤酒痘结挂震锈允沤施磕羹磋蝴禽埔鼓逻去晚茂唇魏纤垂巢愈敛下磺蹦迟秩巧苟盐骑榷忽桂蛛牙婆杉蘸痈瘟汐惭嚼事刽霖嗓酱阵瓷练喷敝渭铭咀檀毕舵砌汾弃渣乌斟浸道栽强藐颇一硼尤醉背即侯 ...

  3. c语言找出一个数组中出现次数最多的那个元素,c语言找出数组中出现次数最多地那个元素...

    matlab中如何找出不同维度矩阵出现次数最多的数组并记录其个数 首先是胞矩阵中的序列问题,不妨假设AA{1}是一个多行两列的数据,AA{2}同例.程序如下clcclearallAA{1}=[12;2 ...

  4. 求一维数组中的最大数c语言,C语言 求一维数组中最大值的位置

    C语言 求一维数组中最大值的位置0 stdlib;=10;;The location is%d"i++) { if(a[i]> return 0#include <:> i ...

  5. c语言中字符串数组的地址存放以及%s输出单个字符导致程序崩溃的问题

    代码 总结下c语言中字符串数组的地址存放问题 #include <iostream> using namespace std; #include<bits/stdc++.h>i ...

  6. c语言程序设计歌手大奖赛,C语言二维数组怎么做:设计青年歌手参加歌曲大奖赛计分系统: 共...,怎样用c语言程序设计? 青年歌手参加歌曲大奖赛,有10个评委...

    导航:网站首页 > C语言二维数组怎么做:设计青年歌手参加歌曲大奖赛计分系统: 共...,怎样用c语言程序设计? 青年歌手参加歌曲大奖赛,有10个评委 C语言二维数组怎么做:设计青年歌手参加歌曲 ...

  7. c++把数组所有元素剔除_C语言基础之数组,第一节,C语言必学知识点剖析

    本文约1600字,主要讲了C语言基础之数组.数组又可分为数值数组.字符数组.指针数组.结构数组等各种类别.本文主要讲了数组的基础概念,一维数组的定义和引用. 带你进入C语言的世界,入门C语言,后边将持 ...

  8. C语言在一个有序数组里插入一个元素,使其成为一个新的有序数组

    C语言在一个有序数组里插入一个元素,使其成为一个新的有序数组 #include<stdio.h> int main(){int a[11] = { 1,5,8,9,25,26,31,35, ...

  9. C语言求3x3数组对角线元素之和

    C语言求3x3数组对角线元素之和 #include <stdio.h> int main() {int i, j,sum=0;int a[3][3];for (i = 0; i < ...

最新文章

  1. node.js express php,nodejs开发——express路由与中间件
  2. Linux防火墙详解(二)
  3. CodeIgniter开发实际案例-新闻网站【转】
  4. HDU-2086 A1 = ?
  5. JSP作用域与特殊对象
  6. p服务器不响应,无法加载资源:服务器响应状态为500
  7. 友益文书类似软件_团队成员分享 | 港中文翻译学姐:硬件不够,软件来凑;心之所愿,无所不能...
  8. QQ解除外链限制,支持直接跳转淘宝抖音
  9. Python之网络编程(基于tcp实现远程执行命令)
  10. android观察者模式例子,Android-Kotlin实现观察者模式的小案例
  11. 正则表达式 判断 连号如“123456”、同号如“888888”、连同号如“112233”“222333”...
  12. mysql共享锁与排他锁
  13. 链接了dpdk的进程启动core在 Illegal instruction
  14. AMD ROCm 硬件支持情况
  15. R plot图片背景设置为透明_万能转换:R图转成Word、PPT、Excel、HTML、Latex、矢量图等...
  16. win7桌面我的计算机打不开怎么回事,win7系统双击我的电脑打不开的解决方法
  17. jQuery 瀑布流插件
  18. win10系统升级没有声音?老司机教你怎么重新安装声卡驱动
  19. 入门学习编程培训有哪些科目课程适合?
  20. android状态栏高度px,安卓720*1280界面尺寸规范参考

热门文章

  1. 什么是SAP Commerce Server
  2. SAP Analytics Cloud学习笔记(一):从CSV文件导入数据到Analytics Cloud里创建模型和Story
  3. 使用wxpy这个基于python实现的微信工具库的一些常见问题
  4. SAP UI5 get route - local version VS central version
  5. How are SAP ui5 Control Aggregation getter and setter are designed
  6. SAP S/4HANA product search generated SQL statement的生产原理介绍
  7. Cloud for Customer的Inplace Edit Container
  8. 根据SAP SAP Cloud Connector的日志排查错误
  9. SAP ABAP实用技巧介绍系列之ABAP取中文字符串的字节长度
  10. HelloWorldProxy is a factory bean