当前位置:网站首页>Find specified characters
Find specified characters
2022-07-03 14:15:00 【Study hard 867】
This question requires the preparation of procedures , Find a specified character from a given string .
Input format :
The first line of input is a character to be found . The second line is a non empty string ending with carriage return ( No more than 80 Characters ).
Output format :
If you find , In one line, according to the format “index = Subscript ” Output the maximum subscript of the character in the string ( Subscript from 0 Start ); Otherwise output "Not Found".
sample input 1:
m
programming
sample output 1:
index = 7
sample input 2:
a
1234
sample output 2:
Not FoundCode :
#include <stdio.h>
int main(){
int i,flag;
char x;
int g;
char a[80];
scanf("%c",&x);
getchar();
for(i=0;(a[i]=getchar())!='\n';i++);
a[i]='\0';
flag=0;
for(i=0;a[i]!='\0';i++){
if(x==a[i]){
flag=1;
g=i;
}
}
if(flag==0)printf("Not Found");
else{
printf("index = %d",g);
}
}边栏推荐
- 好看、好用、强大的手写笔记软件综合评测:Notability、GoodNotes、MarginNote、随手写、Notes Writers、CollaNote、CollaNote、Prodrafts、Noteshelf、FlowUs、OneNote、苹果备忘录
- [clean up the extraordinary image of Disk C]
- 天图投资冲刺港股:资产管理规模249亿 投了小红书与奈雪
- [Jilin University] information sharing of postgraduate entrance examination and re examination
- 7-2 and then what time (15 minutes)
- Exercise 10-1 calculate the sum of 1 to n using recursive functions
- 别再问自己适不适合做软件测试了
- Exercise 9-3 plane vector addition
- FPGA测试方法以Mentor工具为例
- Jiuyi cloud black free encryption free version source code
猜你喜欢

allegro,orcad, net alias,port,off-page connector之间的异同点和如何选取

Solution to failure or slow downloading of electron when electron uses electron builder to package

常见问题之PHP——ldap_add(): Add: Undefined attribute type in

concat和concat_ws()区别及group_concat()和repeat()函数的使用

Message subscription and publishing

Exercise 9-1 time conversion

Jiuyi cloud black free encryption free version source code

玖逸云黑免费无加密版本源码

牛客网:过河卒

npm install卡住与node-npy的各种奇怪报错
随机推荐
常见问题之PHP——ldap_add(): Add: Undefined attribute type in
Redis:字符串类型数据的操作命令
jvm-对象生命周期
JS shift operators (< <,> > and > > >)
关于回溯问题中的排列问题的思考(LeetCode46题与47题)
QT learning 17 dialog box and its types
JS matrix zero
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
Common plug-ins for vite project development
超简单手机地图开发
Onmenusharetimeline custom shared content is invalid, and the title and icon are not displayed
Thinking about the arrangement problem in the backtracking problem (leetcode questions 46 and 47)
SSH访问控制,多次失败登录即封掉IP,防止暴力破解
Cross linked cyclodextrin metal organic framework loaded methotrexate slow-release particles | metal organic porous material uio-66 loaded with flavonoid glycosides | Qiyue
JS input number and standard digit number are compared. The problem of adding 0 to 0
7-11 calculation of residential water charges by sections
剑指 Offer 28. 对称的二叉树
Learn to punch in today
泰凌冲刺科创板:拟募资13亿 国家大基金与小米长江是股东
Example analysis of QT learning 18 login dialog box