7-12 查找奥运五环色的位置

#include<iostream>

#include<string.h>

using namespace std;

int main()

{

int i=0;

char *a[5]={"red","blue","yellow","green","black"};

char b[20];

cin>>b;

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

if(strcmp(a[i],b)==0)

break;

if(i!=5)

cout<<i+1;

else

cout<<"Not Found";

return 0;

}

7-12 查找奥运五环色的位置

分数 10

全屏浏览题目

切换布局

作者 张泳单位 浙大城市学院

奥运五环的5种颜色的英文单词按一定顺序排列{"red", "blue", "yellow", "green", "black" },定义指针数组并初始化,输入任意一个颜色的英文单词,从已有颜色中查找并输出该颜色的位置值,若没有找到,则输出"Not Found"。

输入格式:

输入一个代表颜色的单词。

输出格式:

输出单词对应的位置值,如果未找到,输出Not Found。

输入样例:

yellow

输出样例:

3
在HTML中创建一个格栅布局(Grid Layout),可以让你更好地控制页面元素的排列和空间分配。这里是一个基本的步骤来实现奥运五环效果: 1. **新建HTML文件**: ```html <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>奥运五环 Grid 布局</title> <style> /* 使用 CSS Grid 来定义网格 */ .container { display: grid; grid-template-columns: repeat(5, 1fr); /* 定义5列等宽 */ grid-gap: 10px; /* 间隔大小 */ width: 400px; /* 控制容器宽度 */ height: 400px; padding: 20px; background-color: #f2f2f2; } .ring { background-color: rgba(0, 0, 0, 0.1); border-radius: 50%; position: relative; transition: transform 0.5s ease-in-out; } .red, .yellow, .green, .blue, .black { /* 颜对应奥运五环 */ color: white; font-size: 3rem; text-align: center; line-height: 100px; place-self: center; } .ring:nth-child(odd) { /* 分别设置每个环的位置 */ grid-column: span 2; } .red::before, .yellow::before, .green::before, .blue::before, .black::before { content: &#39;&#39;; position: absolute; width: 75%; height: 95%; top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 50%; z-index: -1; } .red { background-color: red; grid-row: 1 / span 3; } .yellow { background-color: yellow; grid-row: 4; } .green { background-color: green; grid-row: 5; } .blue { background-color: blue; grid-row: 6; } .black { background-color: black; grid-row: 7; } </style> </head> <body> <div class="container"> <div class="ring red">红</div> <div class="ring yellow">黄</div> <div class="ring green">绿</div> <div class="ring blue">蓝</div> <div class="ring black">黑</div> </div> </body> </html> ``` 这个例子中,我们创建了一个包含五个圆环的`<div>`,并利用CSS Grid布局将它们按奥运五环的样式排列。通过`.ring:nth-child(odd)`选择器设置了奇数环的跨度为两列,其余的环占用一列。每个环还有相应的背景颜、文字和内部半透明圆圈。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值