Hi, I am trying to find 2nd largest number that given input of numbers. The question is actually consider that you enter 5 number : 60, 70, 30, 40, 55 randomly -the order does not matter- my function should find 2nd largest number and return it. I am trying but I did not manage to finish my code and actually I can not a way to find true algorithm for this question. The rule is -I know already how I can find max or min number in array, it is simple- [B]you do not use any type of array / …

Member Avatar
Member Avatar
+0 forum 8

Hello, I have a problem about counting consequtive characters, here my code char query[] = "tttthe oneZZZZZ trully loveeee"; void cntfreq(char A[]) { int j; int k=0; j = 1; while (A[j] != '\0') { if (A[j-1] == A[j]) { ++k; cout<<k<<"\t"<<A[j]<<endl; } else k = 0; ++j; } } Suppose that also my char is the following as an input: char query[] = "tttthe oneZZZZZ trully loveeee"; I success in counting the consequtive characters, but it counts minus 1, for example there are 4 consecutive char 't' but it says 3 't' or 5 'Z' character, but it outputs …

Member Avatar
Member Avatar
+0 forum 1

Hello everyone, I have question about how AudioTrack instance should be used for streaming applications. Below my code example and some brief explation about code ... /* some work before */ InputStream in = client.getInputStream(); AudioTrack output_stream = new AudioTrack(AudioManager.STREAM_MUSIC, 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_8BIT, 8192, AudioTrack.MODE_STREAM); byte[] buffer = new byte[8192]; int count; while ((count = in.read(buffer)) != -1) output_stream.write(buffer, 0, count); output_stream.flush(); Now I am in my receiver class where receives sound data from sender class I want to use this sound to play as streaming mode, and in Android API we can use AudioTrack.MODE_STREAM I hear some sound in …

Member Avatar
Member Avatar
+0 forum 1

Hello everyone, I am new at Java(android)-before I have little information about Java lang- and in particular socket programming -before I do not know nothing about socket client server programming-, previously I wanted to write simple chat program by using Threads and now I pass this step, two android emulators can talk each other, to success -just for test even I parse whether it is string or integer- that I use ObjectInputStream and ObjectOutputStream classes with writeObject(obj: MyClass) (in Client Thread class) and readObject() (in Server Thread class). MyClass -just for now I hope with your help- contains only string …

Member Avatar
Member Avatar
+0 forum 8

Hello everyone, I have problem with my simple android chat program when using different test debugging. I have two android emulators one reads SERVERPORT as 8080 and CLIENTPORT as 8082 and the other android emulator reads SERVERPORT as 8082 and CLIENTPORT as 8080 from a given txt file. Here there is no problem and these two emulators can send text message between them **but when I press connect button before press send button at both 2 emulators ** I connect both of them with each other, after that 5-10 s, I catch exception named java.io.EOFException what would be cause that …

Member Avatar
Member Avatar
+0 forum 1

Hello again, I have been posting consecutively in these days nearly same topics, actually I am intern at a sofware company and our company ask to perform the proof of conception about sending voice call -at the beginning- and finally video calls, like walkie talkie application; as you have already seen that I take the problem step by step and I reported the codes my chief -now I transfer .wav files between 2 emulators but just for one time which is also problem for me already posted another thread -thanks a lot for other posting- now I am asking to …

Member Avatar
Member Avatar
+0 forum 2

Hello everyone, I progress step by step my problem, one step is passed -now I can send string datas -text messages- here another step is I want to record some audio sounds by using microphone in first android emulator assume phone1 and send to second android emulator-phone2-. I found whole class about capturing and recording into audio file so I only ask to you that how I can send these recorded sound file -example and assume that I have a file named myFirst.wav in sdcard of first android emulator 5554 **but not in android emulator 5556** what classes in java …

Member Avatar
Member Avatar
+0 forum 6

Hello guys, I start to learn&code some basic small client/server console applications in java -especially in android- and also I try to learn Threads, in fact, I managed to connect 2 different machine by uploading different projects to these machines, for example one project only consists of client and the other project consists of server application, now I want to upload one project to different two machines and connect these two machines. Firstly, I start to learn topic about Threads and take looking some basic code examples about Threads and now I want to combine with client server application but …

Member Avatar
Member Avatar
+0 forum 15

Hello, I am asking about true syntax of the following:: I have a class name P and in header file (of this class) ------> [CODE] class P { public: P(); ~P(); void addItem(const int newItem); void deleteItem(const int Item); void showAll(); /** need to proper getter funct. of tail */ private: struct Node { int item; Node *next; Node *precede; }; int size; Node *tail; }; [/CODE] Now I am asking that how I can write getter function of tail ? -class P will be used by another class. Thanks for replying.

Member Avatar
Member Avatar
+0 forum 4

I have question about if my input matrix was | 1 2 3 4 | | 2 3 4 5 | | 3 4 5 6 | how I would get an output matrix | 0 0 0 0 0 0 | | 0 1 2 3 4 0 | | 0 2 3 4 5 0 | | 0 3 4 5 6 0 | | 0 0 0 0 0 0 | WITHOUT using for loop || is it impossible in GNU octave? second question is, also related the 1. one I have a matrix i.e | 1 …

Member Avatar
Member Avatar
+0 forum 1

Hi, my question is simply but a little bit tricky; let assume that there are two array array1 = (2, 5, 6, 1, 7) and array2 (3, 2, 6, 8) and after function setUnion new array or use pointer return (2, 5, 6, 1, 7, 3, 8). Below my code is shown my problem is I found (2, 5, 6, 1, 7, [B]8[/B], [B]8[/B]) How I fix this problem ? Here my code include main function:: [CODE] #include <iostream> using namespace std; void setUnion (const int array1[], const int size1, const int array2[], const int size2, int &newSize, int *&unionArray) …

Member Avatar
Member Avatar
+0 forum 9

Hello everyone, I am trying to manipulate "DYNAMIC ARRAY" Structures however I've been faced with problems wanting adding new value. Here my code:: -I use CodeBlocks and gnu gcc compiler ^ also I checked it on linux machine. [CODE] #include <iostream> using namespace std; #include "Deneme.h" Deneme::Deneme() { countReg = 0; pArray = new int[(countReg+1)]; for (int i = 0; i < countReg+1; i++) { pArray[i] = NULL; cout<<pArray[i]<<"\t"; } cout<<endl; cout<<"CONSTRUCTOR: "<<endl; } Deneme::~Deneme() { cout<<"DESTRUCTOR: "<<endl; delete [] pArray; } void Deneme::insertEl(int id) { cout<<"Element "<<id<<" has been added "<<endl; pArray[countReg] = id; /** display */ for (int …

Member Avatar
Member Avatar
+0 forum 1

Hello Everyone; I have been trouble with putting Random numbers in an array for an 2 hours My problem is ,yes I know that how I can put Random numbers in an array but, for example my array length is 6 and I generated 1 to 6 random number and first index I putted; hovewer the program should not be replace array[index] to array[index+1] Here my code is shown how can I fix ? Really I need help thank you for your interests. [CODE] public static int[] randomDizi(int size) { final int finalSize = size; // int randomNumber; int newArray[]; …

Member Avatar
Member Avatar
+0 forum 4

The End.