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

help me

مغلق
بدأه الصدق في 19 يوليو 2007 · 10 رد · 1,059 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

عندي سؤال وياريت الاقي جوابه

عبارة عن برنامج طوويل في الـ structure

وارجوا اللي يعرف مايبخل علي

وشكرا لكم

>> السؤال في المرفقات على شكل صورة..

post-128613-1184867598_thumb.jpg

#2

إن شاء الله أكتب لك البرنامج و أضعه

#3

السلام عليكم

أخي من الأفضل أن تحاول قليلا في هذه التمارين وستجد المساعدة. لأن تقديم إجابة جاهزة لن تفيدك في شيء

#4

والله حاولت بس ماقدرت اكمل

وهذا اللي كتبته:

#include "stdafx.h"

#include<iostream>

#include<fstream>

using namespace std;

void getData(

struct manuItemSpecification{

string ingredients[];

string breifdescription;

};

struct manuItem{

string name;

manuItemSpecification description;

double price;

};

struct selectedItem{

string name;

int quantity;

};

manuItem menuList[];

int size=1000;

void getData(

int main(){

ifstream infile;

infile.open("manu.txt");

if(!infile){

cout<<"can not open the file"<<endl;

return -1;

}

void getData(infile,menuList,size);

return 0;

}

void getData(ifstream inf,menuItem List[],int&size){

while(inf){

string nam;

manuItemSpecification description

string ingred[];

string breif;

double cost;

int i=0;

inf>>nam>>cost>>ingred>>breif;

List.name=nam;

List.price=cost;

List.description.ingredients=ingred;

List.description.breifdescription=breif;

i++;

}

size=i+1;

}

احس كله غلط بغلط

#5

السلام عليكم

لقد راجعت الكود وأصلحت الكثير من الأخطاء في الكتابة دون الأخذ بعين الإعتبار ماتريد الحصول عليه.

قارن هذا الكود بالذي عندك لتعرف ما غيرته, ثم واصل تطويره ;)

Testtt.zip

#6

شكرا لك ماتقصر

بس والله ماعرفت افتح الملف !!

#7

انا منزله اصدار ثاني

بس ياريت تحط لي اللي صححته بنووت باد

او صوورة

وشكرا لك

#8

.

Testtt_only_cpp_file.zip

#9

السلام عليكم

اخي الكريم

الاجابات ماتغير فيها شي كلش هذا هي

ماعدا هذا الشي

List.description.ingredients=ingre;

انت عدلتها وسويتها

List.description.ingredients=ingre;

انت قلت انه كان فيه اشياء واجد غلط

ماشفت انه تغير منه شي؟؟؟

#10

دون الأخذ بعين الإعتبار ماتريد الحصول عليه.

؟؟؟؟

شلون ؟؟؟

#11

هذا هو البرنامج

و عذراً على التأخر

#include <stdio.h>
#include <conio.h>
struct manuItemSpecification
{
char* ingredients;
char* breifdescription;
} M[5];
struct manuItem
{
char* name;
manuItemSpecification description;
double price;
} MI[5];
struct selectedItem
{
char* name;
int quantity;
} SI[5];
void getData()
{
	MI[0].description.ingredients = "F1";
	MI[0].description.breifdescription = "Food Number 1";
	MI[0].name = "f1";
	MI[0].price = 24.435;
	MI[1].description.ingredients = "F2";
	MI[1].description.breifdescription = "Food Number 2";
	MI[1].name = "f2";
	MI[1].price = 13.83;
	MI[2].description.ingredients = "F3";
	MI[2].description.breifdescription = "Food Number 3";
	MI[2].name = "f3";
	MI[2].price = 21.558;
	MI[3].description.ingredients = "F4";
	MI[3].description.breifdescription = "Food Number 4";
	MI[3].name = "f4";
	MI[3].price = 20.228;
	MI[4].description.ingredients = "F5";
	MI[4].description.breifdescription = "Food Number 5";
	MI[4].name = "f5";
	MI[4].price = 10.88;
	MI[5].description.ingredients = "F6";
	MI[5].description.breifdescription = "Food Number 6";
	MI[5].name = "f6";
	MI[5].price = 14.424;
}
void showData()
{
	char c;
	printf("Breakfast Menu ...\n\n");
	for (int i = 0; i <= 5; i++)
		{
		SI.quantity = 0;
		printf("%i : %s\n%s\nPrice : $%.3f\n",i + 1,MI.description.ingredients
		,MI.description.breifdescription,MI.price);
		printf("The Customer Want this ?? ");
		c = getche();
		if (c == 'Y' || c == 'y')
		   {
		   SI.name = MI.name;
		   printf("\nHow Much ?? ");
		   scanf("%i",&SI.quantity);
		   }
		printf("\n\n");
		}
}
void printCheck()
{
	 double total = 0;
	 printf("The Customer Has Chosen these things ...\n");
	 for (int i = 0; i <= 5; i++)
	 {
		 if (SI.quantity > 0)
		 {
		 printf("%s With Quantity %i\n",SI.name,SI.quantity);
		 total += SI.quantity * MI.price;
		 }
	 }
	 printf("The Total is $%.3f + 5 percent tax = $%.3f",total,total+(total/20));
}
int main()
{
	getData();
	showData();
	printCheck();
	getch();
	return 0;
}

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

مواضيع مشابهة