<代码收藏>动态生成数组

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
 
void oneArray()
{
     
    int size=rand()%10;
    int* pint=new int[size];
    for(int i=0;i<size;++i)
    {
        pint[i]=rand()%100;
    }
    cout<<"one array is "<<endl;
    for(int i=0;i<size;++i)
    {
        cout<<pint[i]<<"\t";
    }
    cout<<endl;
    delete []pint;
}
 
void twoArray()
{
    int row=rand()%10;
    int column=rand()%10;
    cout<<"row is "<<row<<" column is "<<column<<endl;
    cout<<"two array is"<<endl;
    int** p=new int*[row];
    for(int i=0;i<row;++i)
    {
        p[i]=new int[column];
    }
    for(int i=0;i<row;++i)
    {
        for(int j=0;j<column;++j)
        {
            p[i][j]=rand()%100;
        }
    }
     
    for(int i=0;i<row;++i)
    {
        for(int j=0;j<column;++j)
        {
            cout<<p[i][j]<<"\t";
        }
        cout<<endl;
    }
    cout<<"delete array"<<endl;
    for(int i=0;i<row;++i)
    {
        delete []p[i];
    }
    delete []p;
}
void threeArray()
{
    cout<<"three array"<<endl;
    int height=rand()%10;
    int row=rand()%10;
    int column=rand()%10;
    cout<<"height is "<<height<<" row is "<<row<<" column is "<<column<<endl;
    int*** p=new int**[height];
    for(int i=0;i<height;i++)
    {
        p[i]=new int*[row];
    }
    for(int i=0;i<height;++i)
    {
        for(int j=0;j<row;++j)
        {
            p[i][j]=new int[column];
        }
    }
 
    for(int i=0;i<height;++i)
        for(int j=0;j<row;++j)
            for(int k=0;k<column;++k)
            {
                p[i][j][k]=rand()%100;
            }
 
    for(int i=0;i<height;++i)
    {
        for(int j=0;j<row;++j)
        {
            for(int k=0;k<column;++k)
            {
                cout<<p[i][j][k]<<"\t";
            }
            cout<<endl;
        }
        cout<<endl<<endl;
    }
    cout<<"delete three array"<<endl;
    for(int i=0;i<height;++i)
    {
        for(int j=0;j<row;++j)
        {
            delete []p[i][j];
        }
    }
    for(int i=0;i<height;i++)
    {
        delete []p[i];
    }
    delete []p;
}
 
 
void main()
{
    srand(unsigned(time(NULL)));
    oneArray();
    twoArray();
    threeArray();
    int aa;
    cin>>aa;
}

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <link rel="stylesheet" type="text/css" href="css/bootstrap.css" /> <link rel="stylesheet" type="text/css" href="css/bootstrap-icons.css" /> <link rel="stylesheet" href="css/style.css" /> <link rel="stylesheet" href="css/table.css" /> <style> .bg-f4f6f7 { background-color: #f4f6f7; } </style> </head> <body> <div> <div class="bg-primary d-flex justify-content-between align-items-center row p-3"> <div class="h1 text-white ml-5">Æon</div> <div class="row mr-5"> <img src="img/管理员.png" class="gly mr-1" /> <div>管理员</div> </div> </div> <div class="row bg-f4f6f7"> <div class="sidebar"> <ul class="nav flex-column px-2 py-3"> <li class="nav-item"> <a class="nav-link " href="#" data-template="home"> 首页 </a> </li> <!-- 用户管理 --> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> 用户管理 </a> <ul class="dropdown-menu" aria-labelledby="userDropdown"> <li><a class="dropdown-item" href="#">封禁/解除用户</a></li> <li><a class="dropdown-item" href="#" data-template="users">用户列表</a></li> <li><a class="dropdown-item" href="#">用户行为记录</a></li> </ul> </li> <!-- 歌手管理 --> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="singerDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> 歌手管理 </a> <ul class="dropdown-menu" aria-labelledby="singerDropdown"> <li><a class="dropdown-item" href="#">封禁/解封歌手</a></li> <li><a class="dropdown-item" href="#" data-template="geshou">歌手歌曲</a></li> </ul> </li> <!-- 歌曲内容管理 --> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="songDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> 歌曲内容管理 </a> <ul class="dropdown-menu" aria-labelledby="songDropdown"> <li><a class="dropdown-item" href="#">歌曲收藏</a></li> <li><a class="dropdown-item" href="#">评论管理</a></li> <li><a class="dropdown-item" href="#">歌曲信息</a></li> <li><a class="dropdown-item" href="#" data-template="gedan">歌单管理</a></li> </ul> </li> <!-- 社区管理 --> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="communityDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> 社区管理 </a> <ul class="dropdown-menu" aria-labelledby="communityDropdown"> <li><a class="dropdown-item" href="#" data-template="shequ">帖子审核</a></li> <li><a class="dropdown-item" href="#">帖子发布</a></li> <li><a class="dropdown-item" href="#">举报处理</a></li> </ul> </li> <!-- 数据分析 --> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="analysisDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> 数据分析 </a> <ul class="dropdown-menu" aria-labelledby="analysisDropdown"> <li><a class="dropdown-item" href="#" data-template="data">播放量分析</a></li> <li><a class="dropdown-item" href="#">用户分析</a></li> </ul> </li> <!-- 管理员管理 --> <li class="nav-item"> <a class="nav-link" href="#" data-template="guanli"> 管理员管理 </a> </li> <!-- 系统管理 --> <li class="nav-item"> <a class="nav-link" href="#"> 系统管理 </a> </li> </ul> </div> <div class="m-2" id="contentArea"></div> </div> <template id="homeTpl" class=""> <div class="daohang"> <h5>首页</h5> </div> <div class="homet"> <div class="hometl"> <h6>用户数量</h6> <div class="yonghu mt-4"> <div>新增用户数<a>{{usernum}}</a></div> <div>总用户数<a>{{totalusernum}}</a></div> </div> </div> <div class="hometr"> <h6>歌手数量</h6> <div class="geshou mt-4"> <div>总歌手数<a>{{singernum}}</a></div> </div> </div> </div> <div class="homeb"> <div class="homebl"> <h6>代办事项</h6> <div class="daiban mt-4"> <div>无</div> </div> </div> <div class="homebr"> <div class="homebrt"> <h6>快捷入口</h6> <div class="d-flex justify-content-around mt-4"> <div class="kuaijie"> <img src="img/管理员.png" style="height: 40px;width: 40px;" /> <div>用户</div> </div> <div class="kuaijie"> <img src="img/管理员.png" style="height: 40px;width: 40px;" /> <div>用户</div> </div> <div class="kuaijie"> <img src="img/管理员.png" style="height: 40px;width: 40px;" /> <div>用户</div> </div> <div class="kuaijie"> <img src="img/管理员.png" style="height: 40px;width: 40px;" /> <div>用户</div> </div> <div class="kuaijie"> <img src="img/管理员.png" style="height: 40px;width: 40px;" /> <div>用户</div> </div> <div class="kuaijie"> <img src="img/管理员.png" style="height: 40px;width: 40px;" /> <div>用户</div> </div> <div class="kuaijie"> <img src="img/管理员.png" style="height: 40px;width: 40px;" /> <div>用户</div> </div> <div class="kuaijie"> <img src="img/管理员.png" style="height: 40px;width: 40px;" /> <div>用户</div> </div> </div> </div> <div class="homebrb"> <h6>访问统计</h6> </div> </div> </div> </template> <template id="usersTpl"> <div class="daohang"> <h5>首页->用户</h5> </div> <div class="user"> <div class="sousuo"> <div>用户名:</div> <input placeholder="查询内容" class="pt-2 pb-2 rounded" /> <div class="border border-secondary rounded p-2">查询</div> </div> <div class="zs"> <div class="border border-secondary rounded p-2">新增</div> <div class="border border-secondary rounded p-2">删除</div> </div> <table id="userTable" style="margin-top: 10px;"> <thead> <tr> <th>选择</th> <th>索引</th> <th>用户名</th> <th>头像</th> <th>性别</th> <th>账号</th> <th>操作</th> </tr> </thead> <tbody id="tableBody"> <!-- 数据将通过JavaScript动态加载 --> </tbody> </table> </div> </template> <template id="singerTpl"> <div class="daohang"> <h5>首页->歌手</h5> </div> <div class="singer"> <div class="sousuo"> <div>歌手/歌曲:</div> <input placeholder="查询内容" class="pt-2 pb-2 rounded" /> <div class="border border-secondary rounded p-2">查询</div> </div> <div class="zs"> <div class="border border-secondary rounded p-2">新增</div> <div class="border border-secondary rounded p-2">删除</div> </div> <table id="userTable" style="margin-top: 10px;"> <thead> <tr> <th><input type="checkbox" id="selectAll" class="checkbox"></th> <th>索引</th> <th>歌手</th> <th>照片</th> <th>性别</th> <th>歌曲</th> <th>操作</th> </tr> </thead> <tbody id="tableBody"> <tr> <td colspan="7" class="loading">加载中...</td> </tr> </tbody> </table> </div> </template> <template id="gedanTpl"> <div class="daohang"> <h5>首页->歌单</h5> </div> <div class="gedan"> <div class="sousuo"> <div>歌单:</div> <input placeholder="查询内容" class="pt-2 pb-2 rounded" /> <div class="border border-secondary rounded p-2">查询</div> </div> <div class="zs"> <div class="border border-secondary rounded p-2">新增</div> <div class="border border-secondary rounded p-2">删除</div> </div> <table id="musicTable" style="margin-top: 10px;"> <thead> <tr> <th>索引</th> <th>歌曲名称</th> <th>海报</th> <th>歌曲分类</th> <th>歌手</th> <th>视频</th> <th>操作</th> </tr> </thead> <tbody id="tableBody"> <tr> <td colspan="7" class="loading">加载中...</td> </tr> </tbody> </table> </div> </template> <template id="shequTpl"> <div class="daohang"> <h5>首页->社区</h5> </div> <div class="shequ"> <div class="sousuo"> <div>歌单:</div> <input placeholder="查询内容" class="pt-2 pb-2 rounded" /> <div class="border border-secondary rounded p-2">查询</div> </div> <div class="zs"> <div class="border border-secondary rounded p-2">新增</div> <div class="border border-secondary rounded p-2">删除</div> </div> <table id="shequTable" style="margin-top: 10px;"> <thead> <tr> <th><input type="checkbox" id="selectAll"></th> <th>编号</th> <th>帖子标题</th> <th>发布人</th> <th>发布时间</th> <th>更新时间</th> <th>审核时间</th> <th>状态</th> <th>操作</th> </tr> </thead> <tbody id="tableBody"> <tr> <td colspan="9" class="loading">加载中...</td> </tr> </tbody> </table> </div> </template> <template id="shujuTpl"> <div class="daohang"> <h5>播放量</h5> </div> <div class="shuju"> <div class="sjl"> <h6>平台总播放量分析</h6> </div> <div class="sjr"> <div class="sjrt"> 歌手播放量 </div> <div class="sjrb"> 当前趋势分析 </div> </div> </div> </template> <template id="guanliTpl"> <div class="daohang"> <h5>管理员管理</h5> </div> <div class="guanliyuan"> <div class="gll"> <h6>管理员</h6> </div> <div class="glr"> </div> </div> </template> </div> <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.js"></script> <script src="js/cebianlan.js"></script> <!-- <script src="js/shequ.js"></script> <script src="js/gedan.js"></script> <script src="js/geshou.js"></script> <script src="js/yonghu.js"></script> --> </body> </html>在js中新增20条用户数据,能够进行增删设置,搜索设置
06-14
### 动态添加用户数据及增删查功能的实现 在JavaScript中,可以结合HTML和CSS实现一个简单的用户管理功能,包括动态添加用户数据、删除用户以及搜索用户。以下是一个完整的示例代码,展示了如何通过JavaScript实现这些功能。 #### HTML结构 首先,创建一个基本的HTML表单和表格用于展示用户数据。 ```html <div id="userForm"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()"> <el-form-item> <el-input v-model="dataForm.paramKey" placeholder="请输入用户名进行搜索" clearable></el-input> </el-form-item> <el-form-item> <el-button type="primary" @click="search()">查询</el-button> </el-form-item> </el-form> </div> <table id="userTable" border="1"> <thead> <tr> <th>ID</th> <th>姓名</th> <th>年龄</th> <th>操作</th> </tr> </thead> <tbody id="userBody"></tbody> </table> ``` #### JavaScript逻辑 接下来,编写JavaScript代码动态生成20条用户数据,并实现增删查功能。 ```javascript // 初始化用户数据 let users = []; for (let i = 1; i <= 20; i++) { users.push({ id: i, name: `用户${i}`, age: Math.floor(Math.random() * 50) + 18 }); } // 绑定的数据对象 const dataForm = { paramKey: '' }; // 渲染用户表格 function renderUsers(filteredUsers = users) { const tbody = document.getElementById('userBody'); tbody.innerHTML = ''; // 清空表格内容 filteredUsers.forEach(user => { const row = `<tr> <td>${user.id}</td> <td>${user.name}</td> <td>${user.age}</td> <td> <button onclick="deleteUser(${user.id})">删除</button> </td> </tr>`; tbody.innerHTML += row; }); } // 删除用户 function deleteUser(id) { users = users.filter(user => user.id !== id); renderUsers(); // 重新渲染表格 } // 搜索用户 function search() { const keyword = dataForm.paramKey.trim().toLowerCase(); const filteredUsers = users.filter(user => user.name.toLowerCase().includes(keyword)); renderUsers(filteredUsers); // 根据搜索结果重新渲染表格 } // 初始化页面加载时渲染用户表格 renderUsers(users); ``` #### 样式调整(可选) 为了提升用户体验,可以为表格和按钮添加一些基础样式。 ```css #userTable { width: 100%; border-collapse: collapse; } #userTable th, #userTable td { padding: 8px; text-align: left; } button { margin-left: 10px; cursor: pointer; } ``` --- ### 功能说明 1. **动态添加用户数据** 使用`for`循环生成20条用户数据,并将其存储在`users`数组中[^1]。 2. **删除用户功能** 提供了一个`deleteUser`函数,通过点击“删除”按钮触发,从`users`数组中移除对应用户并重新渲染表格。 3. **搜索用户功能** 实现了一个`search`函数,允许用户通过输入框输入关键词搜索特定用户,并根据搜索结果动态更新表格内容。 4. **表格渲染** 使用`renderUsers`函数将用户数据渲染到HTML表格中,支持过滤后的用户列表显示。 --- ###
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值