Alicito 27 Light Poster

Hello,
I just need some help with linkedlists in C#, linked-list in C++ is kinda easy with pointers but im facing some problems in C#
I read the examples provided on http://msdn.microsoft.com but I couldn't figure out how to link two different linked lists

the efficitent way seems to be having LinkedListNode into a linked list , so lets say I have two linked lists

  LinkedList<String> L1 = new LinkedList<String>();
  LinkedList<String> L2 = new LinkedList<String>();

and then lets say I have the following nodes

            LinkedListNode<String> Ln1 = new LinkedListNode<String>("Orange");
            LinkedListNode<String> Ln2 = new LinkedListNode<String>("Banana");
            LinkedListNode<String> Ln3 = new LinkedListNode<String>("Apple");
            LinkedListNode<String> Ln4 = new LinkedListNode<String>("Strawberry");

I simply added them to the lists I have :

            L1.AddLast(Ln1);
            L1.AddLast(Ln2);
            L2.AddLast(Ln3);
            L2.AddLast(Ln4);

Ok now lets say I want to link the last element of L1 to the first one in L2 , is that possible ?
I tried this first :

L1.Last.Next = L2.First;

I totally failed with an error : Property or indexer 'System.Collections.Generic.LinkedListNode&amp;amp;lt;string>.Next' cannot be assigned to -- it is read only

alright I tried this then :

`Ln2.Next = Ln3;`

I failed again

my last attempt was

            LinkedListNode<String> node1=L1.Last;
            LinkedListNode<String> node2 = L2.First;

            node1.Next = node2;

with an error :Property or indexer 'System.Collections.Generic.LinkedListNode&amp;amp;lt;string>.Next' cannot be assigned to -- it is read only

so any help please ? how to link them ?

an addition questions :
is there away to reach an element in a …

Alicito 27 Light Poster

thank you S.O.S
actually I invoked the following : javac compute/Compute.java compute/Task.java -source 1.5
and it worked

Alicito 27 Light Poster

to build the jar file I'm invoking those commands :
javac compute/Compute.java compute/Task.java ( after invoking this the error appears because I used in the code the template <T> )
jar cvf compute.jar compute/*.class

the version .. when I run sudo update-alternatives --config java
it says : java-6-openjdk

Alicito 27 Light Poster

I am trying to Build a JAR File of Interface Classes
I am using Linux and working throughout the terminal
I keep getting this error

Syntax error , type parameters are only available if source level is 1.5

I searched many sites and most solutions were about java on windows
to change properties

but how can I do that on linux ?
how can I solve this issue please ?

Alicito 27 Light Poster

I'm using the HR@orcl learning account from oracle.
-----------------------------------------------------
and I have the following question :
Create a an SQL query to display the department, the number of employees for that department based on their salary, and the total number of employees for that department, giving each column an appropriate heading.
the salary should be divided like : Less Than 5000,More 5000 And Less 10000 etc .....
-----------------------------------------------------

I tried to use ( Case ) with ( Group By ) but i failed also I tried to use subquery or aggregate functions in the case but it didn't work ...

any help or hint how to solve this .

ex :

select department_id,count(*),case(.....) from employees group by department_id;

it gave errors . any ideas how to solve it .

Alicito 27 Light Poster

my friend SUMY actually I have do the isempty function written as the following

int isEmpty() {
        return head == 0;
    }

but I didnt write it here just not to make the code so long
but you know what .... my code just worked ...
soon I will get a heart attack because of C++
thank you for your help .
and actually this is solved but I dunno how .

Alicito 27 Light Poster

I included this destructor in my code but the problem still there

IntSLList::~IntSLList() {
    for (IntSLLNode *p; !isEmpty(); ) {
        p = head->next;
        delete head;
        head = p;
    }
}
Alicito 27 Light Poster

Hello Friends I'm facing a problem and I can't figure out what is the wrong ( it is a Run~Time~Error)
I have these two classes

//  singly-linked list class to store integers
#ifndef INT_LINKED_LIST
#define INT_LINKED_LIST
class IntSLLNode {
public:
    int info;
    class IntSLLNode *next;
    IntSLLNode(int el, IntSLLNode *ptr = 0) {
        info = el; next = ptr;
    }
};
class IntSLList {
public:
    IntSLList() {
        head = tail = 0;
    }
    ~IntSLList();

    	void Attach(IntSLList); 
private:
    IntSLLNode *head, *tail;
};
#endif

and I have the implementation and the main as the following :

#include <iostream>
#include "Header.h"
using namespace std;

//I have the constructors and the other function written correctly //here

void IntSLList::Attach(IntSLList list) 
{
	cout<<"------"<<endl;
}

void main()
{

IntSLList lst;
IntSLList xst;

lst.Attach(xst);

}

the problem is in the Attach method when I send the (xst) list and it is a run time error .. The Erros is [ block type is valid(phead->nblockuse ]

Alicito 27 Light Poster

ok the problem was with declaring the object , it is supposed to be
int , double , float etc .......
not this

Test<T>c(1);

this

Test<Typename(int float)>c(1);
Alicito 27 Light Poster

Guys I'm having a problem which is really annoying me ..
I'm trying to change a normal class into a template class, but every time I try to do that I get a bunch of problems with the object of that class and the template :
let's say I have this program ( this program is working properly )

//HD.h - header
class Test {
public:
   Test();                // constructor
   void MTD();      // input sales from keyboard
private:
   double X;
   double y;
};
//IMPLE.cpp - implementation 
#include <iostream>
#include "HD.h"
using namespace std;
Test::Test()
{ X=0; }
void Test::MTD()
{
	y=0;
	cout<<"reached"<<endl;
}
//MII.cpp - main
#include <iostream>
#include "HD.h"
using namespace std;
void main()
{
	Test c;
	c.MTD();
}

now the problem starts here I will try to change it into a template class :

//HD.h - header
const int Dsize=10;
template <class T>
class Test {
public:
   Test(int itsSize=Dsize);                // constructor
   ~Test(){delete[]pType;}  
   void MTD();    
   Test& operator=(const Test&);
   T& operator[](int offSet){return pType[offSet];}
private:
	T* pType;
	int itsSize;
   double X;
   T y;
};
//IMPLE.cpp - implementation 
#include <iostream>
#include "HD.h"
using namespace std;
template <class T>
Test<T>::Test(int size):itsSize=size
{	X=0;
pType=new T [size];
}
template <class T>
void Test<T>::MTD()
{
	y=0;
	cout<<"reached"<<endl;
}
//MII.cpp - main
#include <iostream>
#include "HD.h"
using namespace std;
void main()
{
	Test<T>c(1);
	c.MTD();
}

please help me my friends
it says
1.'T' : undeclared identifier
2.'Test' : class has no constructors
3.'Test<T>::MTD' : cannot …

Alicito 27 Light Poster

Thank you so much
as it's givin me the days with some parts of the time
I will let the program save the the numbers before the first Dot in a variable .. and these numbers will represent the days
thank you so much

Alicito 27 Light Poster

hello my friends ... in C# Forms ( application form)
my question is about the (DateTimePicker)
is there any way to calculate the days between two different times which were entered by the tool DateTimePicker by an existing method or something else ...
thank you in advance

Alicito 27 Light Poster

Thank you my friend
that is the missin part

Alicito 27 Light Poster

common its just a for loop wat pasta code are u talkin about
and yea sure i need to scroll up and down, cant u see that the data is so big
again my question is that when im tryin to put the guest in a line and the number in the line
the resultant output starts from the middle of the list
and when i try to output the list it show up properly

Alicito 27 Light Poster

in this program im tryin to keep the guests in a line and the numbers in another line ... but it always start from the middle of the list I dont know why
take a look :

class Program
   {
      static void Main(string[] args)
      {
         string x = "Guest_TheDreamBoi Guest_XxEmoChickGirlxX 2 Guest_babecookieboo 0 Guest_dannnielliee 0 Guest_Cain098 0 Guest_Bwood4Lyfe 12 Guest_shawtylikekiki2 0 Guest_XBrittsaBitchX 6 Guest_Atimas 0 Guest_uzzzzzzzzzzzzzzzzzz 0 camborocker 590 SephRayne 4 Sawyer 261 Guest_Sweet081 310 LuNaZuL666 10 Guest_beautifulbuzzums 93 Guest_Keyshon1994 1 Guest_BellaaBear 0 Guest_lufMEEE xxGangsterBrittanyxx 4 kabald4 33 Guest_hotballer4039 5 Guest_123hypoactive 0 angeal07 120 Guest_billiejeanismyluvr div class='olstatus-container' 0 Guest_Yoshi2222 0 Guest_Katpinzi 15 Guest_xxAngexx3 0 Guest_sexilight 194 twilight5666 1 Guest_xBaByBoOo 0 Guest_loa3 156 Guest_ladybriee 173 Guest_littlehottiemegan 431 Guest_nellynellmarie 0 Istapp 28 iSCR34M Guest_7Ally Guest_StayinKool 206 Guest_lolycrap 4 Guest_WolfXVampire 0 xhalie 57 Guest_spherce 11 Shananacokwaw 1 MerlinDragon 7 Guest_QuiteLikeFalling 53 Guest_Gothic09aust 1 Guest_poofsterlol 0 Guest_vv12729 0 Guest_acehalol 0 Guest_ppppaat Guest_ShadowFoxByakuya 3 Guest_StylishD 19 ReyGirl88 Guest_ZeroGravity23 Guest_XxLynx 86 VampiressesNeferata Guest_LisaReay 288 iLaDiiViRG0 617 PicturePerfect111 208 Guest_MszNegritaa 77 Guest_NosferaTheron 2 Guest_Jasmine4560 2 Guest_shaunxxxxx 0 Guest_Kyniema 0 Guest_bajan12344567 Guest_lyed04 0 Guest_SweetGial971 108 Guest_chadd177 35 Guest_MichealJV 0 Guest_BlackVampire18 637 Guest_LacyRellaX 1 Guest_sashadabomb 25 Guest_0hhEmGee 1 Guest_HotCuteRuby 71 Guest_Bryanjack 273 Guest_oOsexxiiOo Guest_lauriebaby 1 Guest_Saphyre808 0 Guest_AddictingXRetard 0 Guest_DejaVu204 21 Guest_gummieguhh Guest_iD33ZZYY 0 Guest_HaseoAsakura94 96 Guest_iiSooFlYY32 0 Guest_17gansta 0 Guest_lilcooki27 201 Guest_jenniferloui 150 Guest_iN3griitaah 0 Guest_mrright300 31 PrincessAngel1988 170 xxDropDeadVandalxx 28 BreannaLeigh74 22 Guest_XlxRaeRaexlX 244 Remedy 40 Guest_jeremy438 58 Seduisante 494 CholoSolo 1277 Guest_Bloodsis 0 xxxxcherryxlipsxxxx Guest_maddyrox1273 0 Guest_SadnessFeeler 30 Guest_fabulis19 1 Guest_AiScream Guest_De2fly 13 Guest_DjFresh4654 …
Alicito 27 Light Poster

ok sorry for disturbing but I should write
this

arr[i] = Convert.ToInt32(s[i] - 48);

instead of this

arr[i] = Convert.ToInt32(entry[i] - 48);
Alicito 27 Light Poster

I tried it but it didnt work
as I said the problem is a ( run-time error ) so I cant figure wat is it
but its happening in the second constructor

Alicito 27 Light Poster

ok guys what im trying here is to fill array with a big integer number(which is string) by using class-objects
first i made two references n1\n2 to the objects entry and arr
-constructor to assign entry to null
i used a property ( as wanted in the question ) to fill them
then i used the pad left to make them from equal length
then i made another constructor to fill the array but its makin an error
the error is not in the compile time but in the run-time :S
can anyone figure out wats going on

namespace Program
{
   class BigIntegerNumber
   {
      public string entry;
      int[] arr;
      public BigIntegerNumber()
      {
         entry = null;
      }
      public string Fill
      {
         get
         {
            return entry;
         }
         set
         {
            entry = value;
         }
      }
      public BigIntegerNumber(int s)
      {
         arr = new int[s.Length];
         for(int i=0;i<s;i++)
            arr[i] = Convert.ToInt32(entry[i] - 48);
      }
      static void Main(string[] args)
      {
         BigIntegerNumber n1 = new BigIntegerNumber();
         BigIntegerNumber n2 = new BigIntegerNumber();
         Console.Write("Please,Enter the first number :");
         n1.Fill = Console.ReadLine();
         Console.Write("Please,Enter the second number :");
         n2.Fill = Console.ReadLine();
         int local_size;
         if (n1.entry.Length > n2.entry.Length)
         {
            n2.entry = n2.entry.PadLeft(n1.entry.Length, '0');
            local_size = n1.entry.Length;
         }
         else
         {
            n1.entry = n1.entry.PadLeft(n2.entry.Length, '0');
            local_size = n2.entry.Length;
         }
         Console.WriteLine(n1.entry);
         int s1 = n1.entry.Length;
         Console.WriteLine(n2.entry);
         int s2 = n2.entry.Length;
         n1 = new BigIntegerNumber(s1);
         n2 = new BigIntegerNumber(s2);
      }
   }
}
Alicito 27 Light Poster

dear Antenka i forgot to check for new replies :S but anyway thank you so much for your efforts i am done , i solved it by multiplying the two arrays and putting the results in two D dimensional arrays
then adding each column elements and puttin the result in anew array
its workin properly
thank you anyway again :) :*

Alicito 27 Light Poster

my friend can anyone suggest some ideas for me about doing the product
im workin on it .. i did some nested loops .. still workin
I wish if anyone could assist me
i also used some 2-D arrays
it should be like this :
carry----------->1-1
0 0 0 0 0 0 0 0 2 8 7 4
0 0 0 0 0 0 0 0 0 1 1 2
__________________
carry------>1-2-1
0 0 0 0 0 0 0 0 5 7 4 8
0 0 0 0 0 0 0 2 8 7 4 0
0 0 0 0 0 0 2 8 7 4 0 0
__________________
0 0 0 0 0 0 3 2 1 8 8 8
thank you

Alicito 27 Light Poster

i updated the sum operation to this

int u = p + 1;
         int[] sum = new int[u];
         int carry = 0;
         int holder;
         for (int i = p - 1; i >= 0; i--)
         {
            u -= 1;
            holder = arr1[i] + arr2[i] + carry;
            if (holder < 10)
            {
               sum[u] = arr1[i] + arr2[i] + carry;
               carry = 0;

            }
            else
            {
               sum[u] += holder % 10;
               carry = holder / 10;

            }

         }
            if (carry != 0)
               sum[0] = carry;   
         Console.WriteLine("sum is=");
         for (int i = 0; i < sum.Length; i++)
            Console.Write(sum[i]);
         Console.WriteLine();
      }
   }
}

and its working properly
dear Antenka you're my hero :)
ok now I will work on the product operation and inform u with the result
thank you my friend :)

Alicito 27 Light Poster

well my friend Antenka, thank you so much for helping but ...
about the carry you are right , i forgot to type it here , but i used it in my program as holder/10 . but the mistake is not here .. ..
what im trying to do is to make an array to hold the sum of the two integers ( from the different dynamic arrays )
so i named it as ( sum ) and i made its size as ( sumsize ) which is the length of (the longer number + 1) , i did that because of the over flow
or the carry as u said ,
so in the loop i set the size of sum as ( sumsize -1 ) because in adding we add from right to left and the first added number will located in the most significant location of the array
and then at the end of the loop i decrement the sumzie to move left to the next location of the array, and because that the sum array is bigger that the longer number by ( 1 ) location , there will be a place to the carry at the least significant location.
and about the last point ( 1.
for(int i=0;i<sumsize;i++)
)i cant see anything wrong in it
i did this because i want to display the elements of the sum array which is still wrong :S

Alicito 27 Light Poster

lines from 46->65 ( the sum operations )
something is wrong and it is in the size of the sum array
if u tried to put the size -> ( i ) in 52 and 57 it will work
but the over flow will still there
i need to get rid of it

Alicito 27 Light Poster

btw i didnt post the product yet because i want to fix the sum first
and to be more clear , the method is the normal one
I mean something like this :
(1)<--(carry)
9 9
2 3 +
______
122

Alicito 27 Light Poster

hello my friends I need a little help over here :
im workin on a calculator that should provide the user with these services:
• Read a big integer number up to 300 ( use arrays ) .
• Sum two big integer numbers (with using the carry).
• Product two big integer numbers (with using the carry).
• Write a big Integer number.

so this is wat i did

class Program
   {
      static void Main(string[] args)
      {
         //inputting the two numbers .
         string number1, number2;
         int sumsize, p;
         number1 = Console.ReadLine();
         number2 = Console.ReadLine();
         //modifying the numbers to be from the same length .
         /*i added one to the sum array size(sumsize) to avoid 
           the over flow */
         if (number1.Length > number2.Length)
         {
            number2 = number2.PadLeft(number1.Length, '0');
            sumsize = number1.Length+1;
            p = number1.Length;
         }
         else
         {
            number1 = number1.PadLeft(number2.Length, '0');
            sumsize = number2.Length+1;
            p = number2.Length;
         }
         //declaring the two arrays and filling them with characters .
        /* the input is string so when converting it to int i found that 
            i should subtract 48 to get the right result */
         int[] arr1 = new int[number1.Length];
         for (int i = 0; i < number1.Length; i++)
            arr1[i] = Convert.ToInt32(number1[i] - 48);
         int[] arr2 = new int[number2.Length];
         for (int i = 0; i < number2.Length; i++)
            arr2[i] = Convert.ToInt32(number2[i] - 48);
         //displaying the two arrays .
         Console.WriteLine("\n1ST.Number is: \n");
         for (int i = 0; i < number1.Length; i++)
            Console.Write(arr1[i]);
         Console.WriteLine("\n\n2ND.Number is: \n");
         for (int …
Alicito 27 Light Poster

you're welcome lalit , hope you enjoy ur stay with us

Alicito 27 Light Poster

well my friends I tried to solve a problem and it was about allowing the user to enter a paragraph , then the compiler'll count and display the number of typed words .

welll I easily solved it like this

--------------------------------------------------

#include<iostream>
#include<string>
using namespace std;
void main()
{
	int words=0;
	string str;
	getline(cin,str);
	for(int i=0;i<(int)str.length();i++)
		if(isspace(str[i]))
			words++;
	cout<<"number of typed words is: "<<words+1<<endl;
}

-----------------------------------------------------------------------------------
but later I relized that it was very weak program
coz some users use tabs just move the pointing crosser
things like these
so who has a better idea ?

Alicito 27 Light Poster

well friend I think thats you can do it by loops , playing with the cout''s also by using ( \t ) - ( \n ) .........
I think that your solution was the basic step for all others shapes
I will list some for you , I hope that its allowed

--------------------------------------------------------------------------------------

*
  ***
*****
    *
    *
    *
    *
    *
#include <iostream>
using namespace std;
//This program was written by the Programmer Ali Denno
void main ()
{
	int x, k, i, j;
	for(k=1;k<=8;k++)
	{
		if(k!=2 && k!=3)
		{
			for(i=1;i<=5;i++)
			{
				if(i==3)
					cout<<"*";
				else
					cout<<" ";
			}
			cout<<endl;
		}
		else
			if(k==2)
			{
				for(j=1;j<=5;j++)
				{
					if(j==1 || j==5)
						cout<<" ";
					else
						cout<<"*";
				}
				cout<<endl;
			}
			else
			{
				for(x=1;x<=5;x++)
				{
					cout<<"*";
				}
				cout<<endl;
			}
	}
}

--------------------------------------------------------------------------------------

***
  *      *
*          * 
*          *
  *      *
    ***
#include <iostream>
using namespace std;
//This Program was written by the programmer Ali Denno
void main()
{
	int x, i, j, b;
	for(x=1;x<=6;x++)
	{
		if(x==1 || x==6)
		{
			for(i=1;i<=7;i++)
			{
				if(i==3 || i==4 || i==5)
					cout<<"*";
				else
					cout<<" ";
			}
			cout<<endl;
		}
		else
			if(x==2||x==5)
			{
				for(j=1;j<=7;j++)
				{
					if(j==2||j==6)
						cout<<"*";
					else
						cout<<" ";
				}
				cout<<endl;
			}
			else
			{
				for(b=1;b<=7;b++)
				{
					if(b==1||b==7)
						cout<<"*";
					else
						cout<<" ";
				}
				cout<<endl;
			}
	}
}

--------------------------------------------------------------------------------------
an empty square

#include <iostream>
using namespace std;
//This Program was written by the programmer Ali Denno
void main()
{
	int i, j, k;
	for(k=1;k<=6;k++)
	{
		if(k==1||k==6)
		{
			for(i=1;i<=6;i++)
				cout<<"*";
			    cout<<endl;
		}
		else
		{
			for(j=1;j<=6;j++) …
Salem commented: More clueless flogging a dead horse with code (untagged) -7
Alicito 27 Light Poster

I would solve it in this efficient easy way

#include <iostream>
#include <string>
using namespace std;

int countdigits(string word)
{
	int count=0;
	for(int i=0;i<(int)word.length();i++)
	{
		if(isdigit(word[i]))
			count=count+1;
	}
	return count;
}
void main()
{
	string word;
	getline(cin,word);
	int digits=0;
	digits=countdigits(word);
	cout<< digits<<endl;
}
Ancient Dragon commented: IMHO that's the best solution :) +36
siddhant3s commented: Although your algorithm is fine enough, there is no excuse of using void main -2
Alicito 27 Light Poster

thank you my friends
I really appreciate your greeting
best regards for you

Alicito 27 Light Poster

Hello every one ,
I am new , I hope and I will try to be a good memeber here .
my name is Elie 18 years old I study informatic engineering .
I hope that I can help you in threads and you help me back in my threads .
thank you

Alicito 27 Light Poster

sorry my fault

Alicito 27 Light Poster

well , it's an answer for an existed question about 2D product arry
check it back

Alicito 27 Light Poster

<email snipped and color code tags deleted> this is the solution for this problem its kinda long and boring ,but it works properly

#include <iostream>
#include <iomanip>
using namespace std;
void main()
{
	const int r=4, c=4;
	int ar1[r][c];
	int ar2[r][c];
	int sum[r][c];
	int prod[r][c];
	int s=0, y, x;
	cout<<"please enter the elements for the first (4x4) arry"<<endl;
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
			cin>>ar1[i][j];
	}
	cout<<"please enter the elements for the second (4x4) arry"<<endl;
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
			cin>>ar2[i][j];
	}
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
			sum[i][j]=ar1[i][j]+ar2[i][j];
	}
	cout<<endl;
	cout<<" the first array is"<<endl;
	for(int i=0;i<r;i++)
	{
		cout<<endl;
		for(int j=0;j<c;j++)
			cout<<setw(5)<<ar1[i][j];
	}
	cout<<endl;
	cout<<" the second array is"<<endl;
	for(int i=0;i<r;i++)
	{
		cout<<endl;
		for(int j=0;j<c;j++)
			cout<<setw(5)<<ar2[i][j];
	}
	cout<<endl;
	cout<<" the sum of the Two arrays is "<<endl;
	for(int i=0;i<r;i++)
	{
		cout<<endl;
		for(int j=0;j<c;j++)
			cout<<setw(5)<<sum[i][j];
	}
	cout<<endl;
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
		{
			y=0;
			for(int s=0;s<c;s++)
			{
				x=ar1[i][s]*ar2[s][j];
				y=y+x;
			}
			prod[i][j]=y;
		}
	}
	cout<<left;
	cout<<"the Product array is the followin"<<endl;
	for(int i=0;i<r;i++)
	{
		cout<<endl;
		for(int j=0;j<c;j++)
			cout<<setw(8)<<prod[i][j];
	}
	cout<<endl;
}