| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 792 人关注过本帖
标题:我写了一个程序,大家帮我看看哪里有问题
取消只看楼主 加入收藏
wuzihao
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-11-1
收藏
 问题点数:0 回复次数:0 
我写了一个程序,大家帮我看看哪里有问题
// test5.4.cpp : demonstrates passing by value

#include "stdafx.h"
#include "iostream"

using namespace std;
void swap(int x, int y);

int main()
{
    int x = 5,y = 10;

    cout <<"Main.Before swap, x: "<< x <<" y: "<< y << endl;
    swap(x,y);
    cout <<"Main.After swap, x: "<< x <<" y: "<< y << endl;
    return 0;
}

void swap(int x, int y)
{
    int temp;

    cout <<"Swap.Before swap,x: "<< x <<" y: "<< y << endl;

    temp = x;
    x = y;
    y = temp;

    cout <<"Swap.After swap,x: "<< x <<" y: "<< y << endl;
}
搜索更多相关主题的帖子: passing include return 
2008-06-04 11:36
快速回复:我写了一个程序,大家帮我看看哪里有问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011567 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved