首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

急救呀!小弟我这个简单的程序没错呀 都按书上抄的错哪了

2012-04-08 
急救呀!!我这个简单的程序没错呀 都按书上抄的哪里错了?#include iostreamusing namespace stdint main

急救呀!!我这个简单的程序没错呀 都按书上抄的哪里错了?
#include <iostream>
using namespace std;
int main(int argc,char *argv[])
{
  void sort(int x,int y,int z);
  int x,y,z;
  cin>>x>>y>>z;
  sort(x,y,z);
  system("pause");
  return 0;
}
void sort(int x,int y,int z)
{
  int temp;
  if(x>y){temp=x,x=y;y=temp;} 
  if(z<x) cout<<z<<","<<x<<","<<y<<endl;
  else int(z<y) cout<<x<<","<<z<<","<<y<<endl;
  else cout<<x<<","<<y<<","<<z<<endl;
  }
这个是简单的程序 我怎么看都不知道哪里错了!调试就有问题 在17行 请高手看看!!

[解决办法]
#include <iostream > 
using namespace std; 
int main(int argc,char *argv[]) 

void sort(int x,int y,int z); 
int x,y,z; 
cin >>x >>y >>z; 
sort(x,y,z); 
system("pause"); 
return 0; 

void sort(int x,int y,int z) 

int temp; 
if(x > y){temp=x,x=y;y=temp;}
if(z < x) cout <<z <<"," <<x <<"," <<y <<endl; 
if(z < y)cout <<x <<"," <<z <<"," <<y <<endl; 
else cout <<x <<"," <<y <<"," <<z <<endl; 


是这样吗?
[解决办法]
#include <iostream >
using namespace std;

void sort(int x,int y,int z)
{
int temp;
if(x >y){temp=x,x=y;y=temp;} 
if(z <x) cout < <z < <"," < <x < <"," < <y < <endl;
else if(z <y) cout < <x < <"," < <z < <"," < <y < <endl;
else cout < <x < <"," < <y < <"," < <z < <endl;


int main(int argc,char *argv[])
{

int x,y,z;
cin > >x > >y > >z;
sort(x,y,z);
system("pause");
return 0;
}

[解决办法]
你打错了一个字,最后一个if打成int了,这样就可以了
#include <iostream > 
using namespace std; 
int main(int argc,char *argv[]) 

void sort(int x,int y,int z); 
int x,y,z; 
cin>>x>>y>>z; 
sort(x,y,z); 
system("pause"); 
return 0; 

void sort(int x,int y,int z) 

int temp; 
if(x >y){temp=x,x=y;y=temp;}
if(z <x) cout<<z<<","<<x<<","<<y<<endl; 
else if(z<y)cout<<x<<","<<z<<"," <<y<<endl; 
else cout<<x<<","<<y<<","<<z<<endl; 


[解决办法]
英语水平要加强哦,出错了应该会有提示出来的啊,根据提示更正就行了.
鼓励一下!!!^_^
[解决办法]
改了一下,不知道是不是要这种效果。

#include <iostream>
using namespace std;

void sort( int x, int y, int z );

int main( int argc, char *argv[] )


{

int x, y, z;
cin>>x>>y>>z;
sort( x, y, z );
system( "pause" );
return 0;
}

void sort( int x, int y, int z )
{
int temp;
if( x > y )
{
temp = x;
x = y;
y = temp;

if( z < x ) 
cout<<z<<","<<x<<","<<y<<endl;
else if( z < y ) 
cout<<x<<","<<z<<","<<y<<endl;
else 
cout<<x<<","<<y<<","<<z<<endl;
}

热点排行