قسم لغات البرمجة php java c++ جافا Visual Basic فيجوال بيسك c# Delphi دلفي API PERL HTML و TML JavaScript ASP XML Oracle اوركال MySql sql server Access

أدوات الموضوع

بنت مسقط
:: مهندس ::
تاريخ التسجيل: Dec 2010
المشاركات: 2
نشاط [ بنت مسقط ]
قوة السمعة:0
قديم 06-12-2010, 12:19 PM المشاركة 1   
افتراضي طلبتكم لاتردوووني .. محتاااجه مساعدتكم help me Twitter FaceBook Google+



سلام عليكم كييف الحال؟؟

بليز ابغى حل هالاسايمنت ... ماعرفت الحل

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

واكوون شاااكره لكم .. وجزاه الله خير اللي يساعدني




Problem A: Counting
Complete the function TotalChars. TotalChars returns the total number of occurrences of the character ch in each string in list. You should use the string member function to find the number of characters in a string and s[k] for the value of the kth character (indexing starts at 0).

e.g. information technology : i=2, n=3, f=1, o=4, r=1, m=1, a=1, t=1, e=1,
c=1, h= 1, l= 1, g=1, y=1
You should write this function either recursively or iteratively (non-recursively).

Problem B: Replicate
Write the function Replicate. Replicate adds new nodes to list so that nodes are replicated the number of times specified by parameter count. For example, if list is represented by:
("apple","cat","xray")
Then the call Replicate(list,3) should change list as shown below.
("apple","apple","apple","cat","cat","cat","xray", "xray","xray")

Problem C: Reverse
Complete the function Reverse. Reverse reverses the nodes of its parameter list. In writing Reverse you should maintain as an invariant. This invariant would be initialized by the statement: rev = NULL, where rev, since initially no nodes have been reversed and all nodes need to be reversed. Your code will run in O(n) time for an n-node list if you do this correctly.


Problem D: Split
Write a function ListSplit that will split a circular list containing an even number of nodes, say 2k, into two circular lists each of which contains k nodes. The function should have three parameters and should work so that the function call
ListSplit(list,sub1,sub2);
will create new lists linked to by parameters sub1, and sub2 from the list initially referenced by parameter list. After ListSplit has executed, the first parameter should be 0/NULL, i.e., new nodes are not created, but are redistributed evenly between the second and third parameters. It doesn't matter how you divide the nodes between the two lists. Note that you should make no assumptions about the values of first and second in the body of ListSplit.

اعلانات

ملك العلوم
:: عضو فضي ::
تاريخ التسجيل: May 2008
الدولة: Egypt
المشاركات: 192
نشاط [ ملك العلوم ]
قوة السمعة:74
قديم 06-12-2010, 01:01 PM المشاركة 2   
افتراضي


هل لغة البرمجة ++c

اعلانات اضافية ( قم بتسجيل الدخول لاخفائها )
  

بنت مسقط
:: مهندس ::
تاريخ التسجيل: Dec 2010
المشاركات: 2
نشاط [ بنت مسقط ]
قوة السمعة:0
قديم 07-12-2010, 09:37 AM المشاركة 3   
افتراضي


لا اخوووي لغة جافا ...


ملك العلوم
:: عضو فضي ::
تاريخ التسجيل: May 2008
الدولة: Egypt
المشاركات: 192
نشاط [ ملك العلوم ]
قوة السمعة:74
قديم 10-12-2010, 08:22 PM المشاركة 4   
افتراضي


اليك أختى حل السؤال الأول وهو يعد عدد تكرار كل حرف من أحرف الجملة دون حساب المسافة الخالية space
import java.util.*;
import java.io.*;
public class example{
static Scanner console= new Scanner(System.in);
public static void main(String[] args)
{
System.out.print("Please Enter aString ");
System.out.println();
String str =console.next();


char[]third =str.toCharArray();
for(int counter =0;counter<third.length;counter++)
{ char letter= third[counter];

int flage=0;
for ( int i=0; i<third.length; i++)
{
if (letter==third[i])

flage++;


}
if(counter==0)
{
System.out.println("The letter ="+letter+" is repeated "+flage+" No of Times ");
continue;
}
boolean flag=false;
for(int j=counter-1;j>=0;j--)
{
if(letter==third[j])
flag=true;
}
if(!flag)
{

System.out.println("The letter ="+letter+" is repeated "+flage+" No of Times ");
}

}
}


}
اما هذا فهو يعد عدد تكرار كل حرف من أحرف الجملة مع حساب
Space المسافة الخالية
import java.util.*;
import java.io.*;
public class triangle{
//static Scanner console= new Scanner(System.in);
public static void main(String[] args) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Please Enter aString ");
System.out.println();
String str=br.readLine();
System.out.println(str);


char[]third =str.toCharArray();
for(int counter =0;counter<third.length;counter++)
{ char letter= third[counter];

int flage=0;
for ( int i=0; i<third.length; i++)
{
if (letter==third[i])

flage++;


}
if(counter==0)
{
System.out.println("The letter ="+letter+" is repeated "+flage+" No of Times ");
continue;
}
boolean flag=false;
for(int j=counter-1;j>=0;j--)
{
if(letter==third[j])
flag=true;
}
if(!flag)
{

System.out.println("The letter ="+letter+" is repeated "+flage+" No of Times ");
}

}
}


}



واليك الرابط
http://www.java-forums.org/new-java/...er-string.html


التعديل الأخير تم بواسطة : ملك العلوم بتاريخ 10-12-2010 الساعة 08:26 PM
إضافة رد

العلامات المرجعية

«     الموضوع السابق       الموضوع التالي    »
أدوات الموضوع

الانتقال السريع إلى


الساعة معتمدة بتوقيت جرينتش +3 الساعة الآن: 07:09 PM
موقع القرية الالكترونية غير مسؤول عن أي اتفاق تجاري أو تعاوني بين الأعضاء
فعلى كل شخص تحمل مسئولية نفسه إتجاه مايقوم به من بيع وشراء وإتفاق وأعطاء معلومات موقعه
التعليقات المنشورة لا تعبر عن رأي موقع القرية الالكترونية ولايتحمل الموقع أي مسؤولية قانونية حيال ذلك (ويتحمل كاتبها مسؤولية النشر)

Powered by vBulletin® Version 3.8.6, Copyright ©2000 - 2025