#include <STDIO.H>
#include <iostream>
#include <MATH.H>
using namespace std;
int main()
{
int c1=80;
int r=10;
cin>>r;
int r2=r*r;
int i=0,j=0;
for (j=c1;j>-c1;j--)
{
double v=2.2*sqrt(r2-j*j);
double v1=c1-v;
double v2=c1+v;
if (j*j>r2)
{
printf("\n");
continue;
}
for (i=0;i<v1;i++)
{
printf("%c",' ');
}
printf("%c",'*');
for (i=v1;i<c1;i++)
{
printf("%c",' ');
}
//================
for (i=c1;i<v2;i++)
{
printf("%c",' ');
}
printf("%c",'*');
for (i=v2;i<c1+r;i++)
{
printf("%c",' ');
}
printf("\n");
}
return 0;
}
相关推荐
C++输出空心三角形
新人勿喷新手向警告如题,这是一个输出空心三角形的程序不要吐槽万能头文件运行结果:1*2***3******4**** *****5**** ** ******6**** ** ** *******圆代码:#include<bits/stdc++.h> using namespace std; int f(int x){ for(int i = 1;i<x;i++){ ...
【OpenGL C++】画一个空心汉字和一个圆,并填充汉字(中点画线法,中点画圆法,种子填充法)
内容:画一个空心汉字和一个圆 设计一个画任意直线和圆的算法,可选所学的任一图形扫描转换算法(中点或bresenham算法),不能使用任何画线/画圆的API; 使用画线算法实现空心汉字的绘制,汉字必须为4划以上; 使用你设计的画圆算法绘制这个空心字的外接圆; 设计一种填充算法实现汉字的填充; 1.中点画圆法 生成八分之一圆,其他部分可以通过一系列的简单反射变换得到。 (1)已知圆心在原点的圆上的一点的(x,y),函数circlePlotPoint() 根据对称性得到8个对称点,分别为(y,x),(y,-x),
c++画一个空心的圆
打印圆可利用图形的左右对称性。可以算出圆上每一点行和列的对应关系。
在屏幕上用“*”画一个空心的圆
#include <stdio.h> #include <math.h> int main() { double y; int x, m, r; scanf("%d", &r); for (y=r; y>=-r; y--) { m = 2.5 * sqrt (r * r - y * y); ...
C++实现的几种画圆的办法
DDA法画圆(数值微分法) //Bresenham法画圆 //正负法画圆 文档包含同种方法不同的实现
c/c++ 实现控制台下字符画直线,画圆
控制台下 使用字符画直线,画圆 ,DDA算法,BH中点画圆法,(其实是老师布置的作业)。
C++ 画圆
使用C++画圆 1 . 首先我们应该创建好我们的项目和我们的C++文件。 2 . 编辑我们画圆的代码 #include <graphics.h> #include <conio.h> int main() { initgraph(640, 480); circle(320, 240, 100); _getch(); closegraph(); return...
实战分享:如何用Jetson Nano+HM30图传搭建低空YOLOv5检测系统(附VNC避坑指南)
本文详细介绍了如何利用Jetson Nano和HM30图传搭建低空YOLOv5检测系统,重点解决了无人机应用中的硬件连接和VNC延迟优化问题。通过对比WiFi直连与图传方案的优劣,提供了网络配置、VNC优化及YOLOv5模型加速的实战技巧,帮助开发者实现高效稳定的低空目标检测系统。
C++复习(三)——绘制空心圆&求平均值
题目二:在屏幕上用“*”绘制一个空心圆 题目三:十个数据,范围1~100,求去掉最高值和最低值的平均值 /* 题目二:在屏幕上用“*”绘制一个空心圆 分析:圆形半径的平方等于x的平方+y的平方(勾股定理) 这里圆半径取10便于观察 ,求解x的坐标设为* 其余部分设为空格,这里2.5是屏幕的长宽比例, 即调节长宽比,使其正常显示,与之前的余弦函数题目很像 ...
阿里云大模型ACP认证模拟考试(二)
摘要:在阿里云大模型高级工程师 ACP 认证暂无真题题库的现状下,模拟题具有重要意义。其依照真实考试设计,涵盖题型、题量与分值分布,助力考生熟悉考试框架,合理分配答题时间精力,提升效率。同时,模拟题紧扣官方课程,能帮助考生精准定位知识盲点,如大模型架构原理和通义千问应用实践等重点内容,以便针对性完善知识体系。此外,通过练习模拟题,考生可掌握不同题型的解题思维与技巧,快速洞察复杂题目本质,提高答题准确率。
利用Android系统漏洞实现后台弹窗(外弹)
关键:从 Android 8.0(API 26)开始,禁止使用 context.sendBroadcast() 发送隐式广播(即没有指定 setPackage() 或明确组件的广播)。demo核心代码展示利用Android显示系统和广播系统的漏洞实现在后台弹窗的功能,支持最新Android15,16版本。核心功能都是在so层去做,大量使用了jni反调, 如果要上架到应用市场,需要对代码做进一步混淆,加固以应对市场安全扫描。3,开启虚拟显示窗口,这是个透明像素窗口。5,可开启一个线程,调用这个外弹窗口。
C++画一个圆
用C++画一个圆形
芯片测试中的DC与AC模式详解:如何选择最适合你的测试方案?
本文深入解析了芯片测试中DC(直流)与AC(交流)模式的核心差异与互补性。DC测试关注静态电气特性,如固定型故障;而AC测试则聚焦于芯片在额定工作速度下的动态时序行为。文章从VLSI设计、电路模块、成本约束、可测试性设计和应用场景五大维度,提供了如何根据工艺节点、工作频率及具体需求,在testMode配置、时钟复位策略和输入输出接口设计中,平衡两种测试模式以制定最优方案的决策框架。
cocos2d-x 画实心圆以及扇形
cocos2d-x本身提供了画空心圆形的方法,但没有实心圆的方法。在网上找了一下,发现都是从CCDrawingPrimitives.cpp中的ccDrawCircle方法修改而来。虽然实现了实心圆但却不能控制圆形的角度,即只能画圆形不能画扇形。 所以我自己进行了一些修改,总体没有变化,但是添加了实现画实心扇形的功能。 1.首先是函数声明,在CCDrawingPrimitiv
[统计模型] 基于R的潜在剖面分析(LPA)
本文主要介绍基于R进行潜在剖面分析(Latent Profile Aanalysis, LPA)。 关于潜在类别分析LCA/潜在剖面分析LPA的概念和区别,可以参考一下这篇文章: 潜在类别分析LCA \潜在剖面分析LPA介绍https://www.jianshu.com/p/4c830094131e?utm_campaign=maleskine 但是此文对潜类别分析的阐释还比较生涩,而且没有具体的代码编写、模型优选等内容。本文旨在丰富LPA的内容,并希望和大家交流、共同进步。 1. 什么是潜类别分.
CloudCompare 二次开发(16)——计算点云最值
不依赖任何第三方点云相关库,使用ClopudCompare计算点云最值。
绘制实心圆
先看绘圆的代码: //Draw Circle use brush CBrush brush1(RGB(255,0,0)); //red old = pDC->SelectObject(&brush1); CRect cRect; cRect.SetRect(0,0,0,0); //圆心是(0,0) cRect.InflateRect(50
大模型的实践应用31-基于通义千问大模型改进台风和海浪预测研究,利用机器学习与通义千问结合的思路实现对台风和海浪预测分析
通义千问大模型是阿里巴巴云推出的一款大规模语言模型,旨在通过强大的自然语言处理能力提供更广泛的服务。从最初的构想到如今的广泛应用,通义千问的发展见证了人工智能领域尤其是自然语言处理技术的巨大进步。自发布以来,通义千问不断迭代升级,不仅在规模上实现了飞跃式的增长,在性能方面也得到了显著提升。本次研究尝试将通义千问强大的自然语言处理能力与经典的时间序列预测算法相结合,旨在提高对未来天气状况预测的精度。具体来说,首先使用通义千问生成高质量的文字描述来增强特征表达力;
修改cocos2d-x-2.2.5的框架,增加画实心圆的函数ccDrawSolidCircle
cocos2d-x-2.2.5的框架自带的画圆函数,默认是空心圆,不能满足项目需求。所以添加了一个画实心圆的函数,
Docker Desktop 从 C 盘迁移到 D 盘的正确方法
本文介绍了三种将Docker数据目录从C盘迁移到D盘的方案。方案1针对WSL2用户,通过导出/导入虚拟磁盘实现迁移;方案2采用软链接方式,适合所有Docker模式;方案3则建议重装Docker到D盘。其中WSL2迁移方案(方案1)最为稳定可靠,推荐使用。文章详细说明了各方案的操作步骤及注意事项,并提供了迁移后常见问题的解决方法,帮助用户彻底解决Docker占用C盘空间的问题。
Probability and Statistics - 4th edition
Probability and Statistics - 4th edition
C++ 打印菱形(实心和空心)
打印菱形 打印菱形1、打印实心菱形2、打印空心菱形 打印菱形 1、打印实心菱形 #include<iostream> using namespace std; int main() { cout << "Please enter the side length of the diamond:"; int n; cin >> n; for (int i = 0; i<n; i++) // 分为上半层打印和下半层打印,首先打
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
【C++】B2083 画矩形
在C++教学和练习中,一笔字行进行矩形计算和输出,是非常有代表性的入门题目。本文将分析一个关于在统计上输出实心和空心矩形的题目,分举主要分析此题目的思路,对比学生和老师作品,提供优化解出,以及适当的学习拓展。 2024.12.31-✍50min
IDEA的使用指南
IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.
老版QQ原生表情gif动态
这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。
有关圆的c语言程序,如何用c语言程序画一个圆?
以一个空心圆来举例。/* 判断是是否在圆上 */int isAtCircle(int x, int y, int r){/* 将(x, y)转换为相当圆心(r, r)的坐标 */int rx = x - r;int ry = y - r;double d = sqrt(rx*rx + ry*ry) - r; /*计算到圆心的距离*/if(fabs(d) < 0.5)="">return...
php编写空心正方形,C++ 画星号图形——空心正方形(核心代码)
//输出m行m列的空心正方矩形。int m;//m用来控制行列数。cout<=4):\n";cin>>m;for(int i=;i{for(int j=;j{if(i==||i==m-){cout<}elseif(j==||j==m-){cout<}elsecout<}cout<}C++ 画星号图形——圆形(核心代码记录...
【C++】空心菱形
题目描述 输入一个整数n,(1<=n<=20),输出一个空心菱形,其中每个边由n个’*'组成。 输入 输入包含一个整数,n(1<=n<=20) 输出 输出一个空心菱形,每个边由n个’*'组成 样例输入 5 样例输出 * * * * * * * * * * * * * * * * 代码 #incl...
3116



被折叠的 条评论
为什么被折叠?



