当前位置:网站首页>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);
}
}边栏推荐
- QT learning 21 standard dialog box in QT (Part 2)
- Eight sorts
- Message subscription and publishing
- Webpage connection database ~ simple implementation of addition, deletion, modification and query complete code
- Analysis of the characteristics of page owner
- Common plug-ins for vite project development
- Page generation QR code
- MongoDB索引
- 添加Zabbix计算类型项目Calculated items
- Back to top implementation
猜你喜欢

7-7 12-24 hour system

信创产业现状、分析与预测

QT learning 25 layout manager (4)

GRPC的四种数据流以及案例
[email"/>Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email

Redis: commandes d'action pour les données de type chaîne

Example analysis of QT learning 18 login dialog box

7-18 finding the single root of polynomial by dichotomy

Leetcode(4)——寻找两个正序数组的中位数

Exercise 8-7 string sorting
随机推荐
FPGA test method takes mentor tool as an example
6-9 statistics of single digits (15 points)
Duet date picker (time plug-in that can manually enter the date)
C library function - qsort()
MongoDB数据库入门的常用命令
7-2 and then what time (15 minutes)
Leetcode(4)——尋找兩個正序數組的中比特數
全局事件总线
天图投资冲刺港股:资产管理规模249亿 投了小红书与奈雪
7-7 12-24 hour system
Mysql多表查询 #子查询
JS get DPI, PX to cm, cm to PX
编程语言:类型系统的本质
jvm-类加载
牛客网:过河卒
Interface for querying IP home
7-17 crawling worms (break exercise)
7-9 find a small ball with a balance
Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content
Metal organic framework MOFs loaded with non steroidal anti-inflammatory drugs | zif-8 wrapped Prussian blue loaded quercetin (preparation method)