شما این محصولات را انتخاب کرده اید

سبد خرید

صف در C++
شناسه پست: 4704
بازدید: 2484

متن سربرگ خود را وارد کنید

				
					#include <iostream.h>
#include <conio.h>
#include <math.h>

//------------sourcea.ir----------------------------------//


#include "stdafx.h"

using namespace std;


typedef struct student
{
	int id;
};
student st[3];
int c=-1;
void menu();
void add();
void del();
void display();



int _tmain(int argc, _TCHAR* argv[])
{
	menu();
	_getch();
	return 0;
}

void menu()
{
		int n,f=1;
	while(f)
	{
		
	//system("cls");
	
	cout<<"\n1) Add";
	cout<<"\n2) Delete";
    cout<<"\n3) Display";
	cout<<"\n4) EXIT";
	cout<<"\nSelect Item 1-2-3-4:   ";
	cin>>n;
	
	switch(n)
	{
	case 1:
	    add();
		break;
	case 2:
		del();
		break;
	case 3: 
		display();
		break;
	case 4:
		f=0;
		break;
	}
	}
}

void add()
{
	if(c!=2)
	{
		++c;
    cout<<"\nEnter Id:    ";
	 cin>>st[c].id;
	cout<<".......number add in list.......";
	}
	else
	cout<<"........Queue is full.........";
}

void del()
{
	if(c!=-1)
	{
		--c;
		cout<<"\nItem Is Delete.....press Ay Key......";
	}
	else
		cout<<"........Queue is empty.........";
}

void display()
{
	if(c!=-1)
	{
	for(int i=0;i<=c;++i)
		 cout<<"\tId=  "<<st[i].id<<endl;
	}
	else 
		cout<<"........Queue is empty.........";
}
				
			

توضیحات:

صورت سوال:

صف در C++

این برنامه ساختار صف را در زبان C++ پیاده سازی می‌کند.

شما میتوانید سوالات خود را از طریق ایمیل پشتیبانی – تماس با ما – یا در قسمت نظرات سوال خود را بپرسید.

موفق باشید

A.J

پست های مرتبط:

فروشگاه سورسا:

اشتراک در
اطلاع از
guest

0 نظرات
قدیمی‌ترین
تازه‌ترین بیشترین رأی
بازخورد (Feedback) های اینلاین
مشاهده همه دیدگاه ها