Following is the final code I was working on. I can sleep and show again other messages with sleep() but I can't print what I originally wanted which is inside 2nd while loop. As far as I tested, while((ptr=getutent()) != NULL) would be the problem but I don't know how to solve. I would really appreciate if anyone can help me. Thanks
No...
I tried to add objects to the "content" vector, and use show() on all of them.
But the objects that are children (A, B) of "Base" behave like they were of "Base" type,
what is not my intention. As it seems, I tried to use virtual functions but it doesn't work.
I hope that the code will speak for itself.
class Base {
public:
...
Scenario
I am attempting to implement supervised learning over a data set within a Java GUI application. The user will be given a list of items or 'reports' to inspect and will label them based on a set of available labels. Once the supervised learning is complete, the labelled instances will then be given to a learning algorithm. Thi...
Hey guys, if I have an array that looks like [A,B,C,A,B,C,A,C,B] (random order), and I wish to arrange it into [A,A,A,B,B,B,C,C,C] (each group is together), and the only operations allowed are:
1)query the i-th item of the array
2)swap two items in the array.
How to design an algorithm that does the job in O(n)?
Thanks!
...
Hello, I am working on an assignment that asks me to implement an AVL tree. I'm pretty sure I have the rotation methods correct, but I'm having trouble figuring out when to use them.
For example, the explanation in the book says that I should climb up the same path I went down to insert the node/element. However, I can't have any parent...
I came across omegle.com webiste.I know that picks two random strangers and pairs them up and then can chat. In short, i know the functionality of it. But i want to create a similar project as my final year project, so i want to understand the technical details of it.
Can any one suggest which will be the best technology for devloping s...
I am writing aa mastermind guessing game, but in the “White Check”, I need to remember (know) the positions of all the position “Blacks”. These positions are not required checking again. Then for “each” non-black player “guess” array compare it against “each” non-black computer “answer” array. To find a match. If find any number in the “...
“White" is the checking of correct number at wrong position.
But I don't know how to count it correctly.
#include "stdafx.h"
#include "stdlib.h"
#include "time.h"
int _tmain(int argc, _TCHAR* argv[])
{
int answer[4];
int guess[4];
int count = 0;
srand(time(NULL));
/*answer[0] = (rand() % 6)+1;
answer[1] = (ra...
I want to rewrite the "cp" command of Linux. So this program will work like #./a.out originalfile copiedfile. I can open the file, create new file but can't write the new file. Nothing is written. What could be the reason?
The current C code is:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include...
i need to write a function which calculates how many elements on list with scheme language.
for example
(howMany 'a) returns 0
(howMany '(a b)) returns 1
(howMany '(a (b c))) returns 2
how can i do that? i did not want a working code, just only an idea for do that. so maybe you should consider to remove working codes. :) thank you
...
Hey guys,
For one of my assignments I have to make 2 different CSS style sheets and I have done that. Now in the assignment it says that if I want to I can link the two style sheets to just one html page, so I'm guessing that there will be two options to switch between the two styles.
My question: How do I achieve this? I heard that the...
Hello, I am trying to implement an inner class that has generic parameterized type.
Here is my code (short version):
public class AVLTree<T extends Comparable<? super T>> implements Iterable<T> {
...
private class BinaryNode<T extends Comparable<? super T>> {
...
}
private class TreePreOrderIterator<E extends Comparable<? super...
public class Guess {
public static void main(String[] args){
<sometype> x = <somevalue>;
System.out.println(x == x);
}
}
i have to change sometype and somevalue so that it returns false? is it possible?
...
Hi guys, I'm learning Java (2nd year IT student) and I'm having a little problem. With inheritance to be precise. Here's the code:
class Bazowa
{
public Bazowa(int i)
{
System.out.println("konstruktor bazowy 1");
}
public Bazowa(int j, int k)
{
System.out.println("konstruktor bazowy 2...
Hi, this program accepts user input and saved to a char array. Then creates a file and put those texts to the new file. Problem is, it can only copy the part before space.
Current Output : "how to read" --> "how"
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argv, ...
Ok, so I have a char stringA and char stringB, and I want to be able to insert stringB into stringA at point x.
char *stringA = "abcdef";
char *stringB = "123";
with a product of "ab123cdef"
does anyone know how to do this? Thanks in advance
...
Exposition:
In general, Reference Counting has the weakness of "it can't detect loops." However, in some cases, Reference Counting is really useful:
class EmergencyPatient {
DoctorPtr doctor;
EmergencyPatient() { doctor = Doctor::acquire(); }
~EmergencyPatient() { Doctor::release(doctor); }
};
Now, in a reference counted world...
I am developing a unit converter for my semester project. I need some help on the structure of the classes/interfaces/abstract classes. I want some interface or abstract class that can be inherited by classes (DegreesConverter, MassConverter, LenghtConverter). Like maybe interface IUnitConvert<Type>. I will be dealing with units of angle...
Say I have a CString object strMain="AAAABBCCCCCCDDBBCCCCCCDDDAA";
I also have two smaller strings, say strSmall1="BB";
strSmall2="DD";
Now, I want to replace all occurence of strings which occur between strSmall1("BB") and strSmall2("DD") in strMain, with say "KKKKKKK"
Is there a way to do it without Regex. I cannot use regex as adding...
Dear all,
How can I add an integer variable to a string and char* variable? for example:
int a = 5;
string St1 = "Book", St2;
char *Ch1 = "Note", Ch2;
St2 = St1 + a --> Book5
Ch2 = Ch1 + a --> Note5
Thanks
...