Learning Visual Studio
Would you like to react to this message? Create an account in a few clicks or log in to continue.

bai 141 lap trinh mang

Go down

bai 141 lap trinh mang Empty bai 141 lap trinh mang

Post  Admin Mon Dec 08, 2008 7:39 am

// stdafx.cpp : source file that includes just the standard includes
// Itec.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "iostream"
using namespace std;
void nhap(int a[],int &n)
{
cout<<"Nhap so luong phan tu cua mang:";
cin>>n;

for(int i=0;i<n;i++)
{
cout<<"Nhap a["<<i<<"]:";
cin>>a[i];
}

}
void xuat(int a[],int n)
{
cout<<"Xuat mang :";
for(int i=0;i<n;i++)
{
cout<<" "<<a[i];
}
}
int mangduong(int a[],int n,int b[],int &m)
{
//gan m=0
m=0;
//duyen mang a
for(int i=0;i<n;i++)
{
//neu a[i]>0 thi gan b[n]=a[i]
if(a[i]>0)
{
b[m]=a[i];
m++;
}


}
if(m==0)return -1;
else return 1;
}

int min_duong(int b[],int m)
{
int min=b[0];

for(int i=0;i<m;i++)
{
if(min>b[i])
min=b[i];
}

return min;

}
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

Admin
Admin

Posts : 4
Join date : 2008-12-08

https://tranvantam2009.board-directory.net

Back to top Go down

bai 141 lap trinh mang Empty c++ pointer part 1

Post  Admin Mon Dec 08, 2008 10:42 pm


Admin
Admin

Posts : 4
Join date : 2008-12-08

https://tranvantam2009.board-directory.net

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum