求帮写一个很简单的程序设计C++

来源:百度知道 编辑:UC知道 时间:2024/06/14 02:56:41
输入m
h=50,g=9.8
l=h-(2mgh/k)^0.5
f=k(h-l)
输出以下结果
l,f

没告诉的变量在输出结果中保留为字符串

请写出完整的能运行的C++
另外最好写得看得比较多一点复杂一点

另外需要明天之内完成
谢谢~!!

#include<iostream.h>
#include<math.h>
#define h 50 /*define the height 50M */
#define g 9.8/*define acceleration 9.8m/s^2 */
//begin main()
int main()
{
cout<<"******************************************************************************"<<endl;
cout<<"-------------------------------welcome, man-----------------------------------"<<endl;
cout<<"---------------------------help information-----------------------------------"<<endl;
cout<<"if you want to execute the program,please input 'y',else input 'n':"<<endl;
char ifexe;//define sign to infinite execute the program or not
double m;//define m and l
while(cin>>ifexe)
{
if(ifexe=='n'||ifexe=='N')
{
cout<<"You have made the choice of n,exit......"<<endl;
cout<<&qu