الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

برناااااااامج رهيييييييييييييب

مغلق
بدأه tariq2002 في 22 أكتوبر 2001 · 4 رد · 539 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

hiii i got this program and i like u guys to help me ok :

this is it :

write a c program using arrays,functions and switch case with menu to do the following :a small air lines has just purchased a computer for its new automated reservation and u have to do a program to assign seats on each flight of the airlines only plane ( capacity 10 seats ). ur program should display the following menu of alternatives: reservation system

1_ smoking seats

2_ non smoking seats

3_ exit

if the person types 1,then your program should assign a seat in the smoking section (seats from 1 to 5) if the person press 2 then your program should assign a seat in the non smoking section (seats from 6 to 10 ). your program should then print a boarding pass indicating the persons seat numbers and whether it is in the smoking or non smoking section of the plane .

use asingle subscripted array to represent th seating chart of the plane . initialize all the elements of the array to zero. to indicate thats all seats r empty . as each seats is assigned , set the coresponding elements of the array to 1 to indicate that the seats is no longer available.

ur program should ask the person if it is acceptable to be placed in the non smaking section when the smoking section is full ( and vice vrsa). if yes then make the appropriate seat assigment . if no , then print the message "next flight leaves in 3 hours"

آسف اذا تقلت عليكم بس اريد البرنامج قبل 2112000 ارجووووكم

#2

السلام عليكم و رحمة الله

هذا البرنامج محاولة منى لمساعدتك لعله يفيدك

#include
int ar[10];

int Input()
{
	int code,
		smoke_count=0,nonsmoke_count=0;
	bool exit=0;
	char q;
	int i=0;
	printf("Enter What you need:n(1)for smoking seatsn(2)for nonsmoking seatsn(3)for exit.n");
	do
	{
		printf(">>");
		scanf("%d",&code);
		switch (code)
		{
		case 1:
			if (smoke_count<5)
			{	ar=1;smoke_count++;	}
			else
			{
				printf("Is it acceptable to be placed in the nonsmaking section because smoking section is full.(y/n)?");
				scanf("%s",&q);
				if (q=='y') 
				{	ar=2; nonsmoke_count++;	}
				else 
				{	printf("next flight leaves in 3 hoursn"); i--;	}
			}
			break;
		case 2:
			if (nonsmoke_count<5)
			{
				ar=2; nonsmoke_count++;
			}
			else
			{
				printf("Is it acceptable to be placed in the smaking section because nonsmoking section is full.(y/n)?");
				scanf("%s",&q);
				if (q=='y') 
				{	ar=1; smoke_count++;	}
				else 
				{	printf("next flight leaves in 3 hoursn"); i--;	}
			}
			break;
		case 3:
			exit=1;
			i--;
			break;
		default: 
			printf("Invalid Code! Access Ignored.n");
			i--;
		}
		i++;
	} while (i<10 && exit==0);
	return i-1;
}

void Output(int num)
{
	for (int i=0;i<=num;i++)
		if (ar==1)
			printf("Person No %d is in smoking sectionn",i+1);
		else
			printf("Person No %d is in nonsmoking sectionn",i+1);
}

void main()
{
	int j=Input();
	Output(j);

}
#3

أخ كريم ،

أهلا وسهلا فيك في هذا المنتدى وفي موقع الفريق العربي للبرمجة ..

أتمنى لك أن تستمر معنا وقد زرت صفحتك وأعجبني الجهد المبذول في برنامجك جرافيكا ..

بالتوفيق ،

Coding on the Cloud and for the Cloud!

My Blog

#4

hello karim ....

it is me muhammad

7.45

:)

#5

اشكرك كثير على الرد السريع و اتمنى اني اتعرف عليك أكثر اذا ممكن على الماسنجر

tariq2002_je@hotmail.com

هذا الموضوع مغلق.