我是你吧吧 关注:47贴子:178
  • 2回复贴,共1
  • 202.116.81.*

#include "stdafx.h"
#include<iostream>
#include<string>
using namespace std;
string blank="         ";
int main(int argc, char* argv[])

float a;int b,i,j,k;
cout<<"input 24 temperatures"<<endl;
cin>>a;
cout<<-30<<blank<<0<<blank<<+30<<blank<<60<<blank<<90<<blank<<120<<endl;
i=1;
while(i<=24)

if(a>=0)
{b=int(a/3.0+.5);
 cout<<a<<blank<<'|';
 j=0;
 while(j<b)
 { cout<<'*';j++;}
}
else
{b=int(-a/3.0+.5);
cout<<a;
j=0;
while(j<(9-b))
{cout<<' ';j++;}
k=0;
while(k<b)
{cout<<'*';k++;}
cout<<'|';}
cout<<endl;
i++;
cin>>a;
}
cout<<' ';
return 1;
}



1楼2009-11-12 11:58回复