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

سؤال Data Sturcture

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

هيدا سؤال اول شي

بانوا نكتبPALINDROME بواسطة لغة السي بلس بلس

ونكتبوا باستخدام Stack application

والبرنامج بيحكي

• Write a program to read a string and determine if the string is a palindrome. A palindrome is a string which is the same whether the characters are read from left to right or from right to left. For example "radar" , "deed", and "able was I ere I saw elba" are all examples of palindromes.

• The palindrome algorithm is simple: compare the reverse of the string with the original string. If they are the same, the string is a palindrome.

• Use a stack ADT and any other structured data type with it as array of characters

• Use Two Files a .h and a .cpp File

وهادا تم الاجابة عليه واجابته هايتها

اقتباس
ملف السي بلس بلس

#include<iostream.h>

#include<conio.h>

#include<stdlib.h>

#include<stdio.h>

#include"pal.h"

void main()

{

clrscr();

stack st;

char arr[30]="";

cout<<"please enter a string";

cin>>arr;

int x=0;

while (arr[x])

x++;

int i;

for (i=0;i<x;i++)

st.push(arr);

for (int a=0;a<x;a++){

if(arr[a]==st.top()) {

st.pop();

continue; }

else

break;}

if(a==x)

cout <<"paledrom";

else

cout <<"not paledrom";

getch();

}

//End main

ملف .h

اقتباس
#include<iostream.h>

#include<conio.h>

#include<stdlib.h>

#include<stdio.h>

stack::stack()

{

mytop=-1;

}

int stack::empty()

{

return (mytop==-1);

}

void stack::push (stack_element &value)

{

if (mytop < size-1)

{

mytop++;

myarray[mytop]=value;

}

}

void stack::pop()

{

if (mytop != -1)

mytop --;

else

cerr<<"stack is empty";

}

stack_element stack::top()

{

if (mytop !=-1)

return (myarray[mytop]);

else

{

cerr<<"stack is empty";

return -1;

}

}

void stack::display()

{

for(int i=mytop ; i>= 0; i--)

cout<< myarray ;

}

const int size=20;

typedef int stack_element;

class stack

{

private:

int mytop;

stack_element myarray ;

public:

stack();

int empty();

void push(stack_element &value);

void pop();

stack_element top();

void display();

};

وبدنا بنفس البرنامج بلغة السي بلس بلس

ولكن باستخدام Queue application

As You Worked in assignment 2 , Write a palindrome program , But this Time Use Queue and Stack ADT's in your program

• Use Two Files a .h and a .cpp File

لو سمحتم بس المساعدة باستخدام الـــQueue application

بس هادا السؤال

ضروري الله يخليكم

والله كتير محتاجها

تم تعديل هذه المشاركة بواسطة rana1 في 21 أكتوبر 2007 في 21:26

50988445.gif

RaNoUsH GrApHiC dEsIgNeR

#2

دخيلكم

انا

والله السؤال كتير محتاجة ضروروي

ولازم اسلموا بائرب وئت ممكن

بس لو سمحتم مساعدة

:(

50988445.gif

RaNoUsH GrApHiC dEsIgNeR

#3

لو موجود عند حدا الطريئة

ممكن لو فيو يئلي اياها

50988445.gif

RaNoUsH GrApHiC dEsIgNeR

#4

طيب يا اختي rana اين هي محاولتك على حل السؤا ل.. ؟؟

يجب ان تكتبي المحاولة لكي نستطيع معرفة اين توقفتي ..

بصراحة هذه البرامج الخاصه بالداتا ستركجر تحتاج الى وقت لحلها ...

لا يمكن كتابة برنامج بالسرعه التي تطلبيها ...

تحياتي العطرة واسف لاني الان لا استطيع المساعده لانكي تطلبين السرعه في الحل ..

يَارَبُ إِن ضَاقَت قُلُوُب الْنَّاسٍ عَنْ مّافِي .. مِنْ خَيْرٍٍ فَعَفْوكَ لَا يَضِيْقْ ..

#5

انا اخر موعد بكرا

يعني لو فيكن تشوفولي يااه

50988445.gif

RaNoUsH GrApHiC dEsIgNeR

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

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