+1(316)4441378

+44-141-628-6690

Archive for the ‘programming’ Category

CString class

Each modern programming language provides a way of expressing character strings. For instance, in C language, there is no built-in data type for strings, but instead, they appear as null-terminated character arrays. However, there is a library named string.h that includes several predefined string-handling functions. In C++, on the other hand, there is no built-in string object, however, there is a class named string in the standard C++ library that gives way better type-safe and more functionalities compared to the C library.
Thus, in this programming assignment, students are expected to study the standard C library, namely, the string.h, and convert it to a fully-operating class. To clarify the task, let me give a simple example as in the sequel.
In C, one can write a simple two-line code to present how a string stored in one array can be copied into another one.
char s1[] = "a string", s2[10]; strcpy(s2, s1);
Note that in the example given above, we consider the standard

graph representation of this code

Please write out a graph that represents the code below. This code creates a graph using Dictionary (denoted by { }).

graph = { "a" : ["c"],

          "b" : ["c", "e"],

          "c" : ["a", "b", "d", "e"],

          "d" : ["c"],

          "e" : ["c", "b"],

          "f" : []

        }


**Note: Do not send this in a program!  I want to see a graph representation of this code only

extract sentences and numbers

Part I - download a book
1.    Download a copy of "The Adventures of Sherlock Holmes" by Arthur Conan Doyle from the Project Gutenberg website - https://www.gutenberg.org/ .

Make sure that the file you download is a UTF-8 format file. Using a UTF-8 format file will ensure that any "special" characters that fall outside of the standard English ASCII character set will be displayed correctly within R.

2.    Read the text of the book into R with the readLines function, specifying  the encoding as "UTF-8". Note that "UTF-8" must be in ALL CAPS and must have a dash before the number 8.  For example:

    book <- readLines("myfile.txt", encoding="UTF-8")

At this point the variable book will contain a character vector that contains the lines of the book.


Part II - convert the vector of lines of the book into a vector of sentences
1.    Write a function called sentenceify tha

Critter 2.0

Modify the Critter Caretaker game from the book by adding an unlisted (not shown to the player) debug option in the menu to give exact values of m_hunger and m_boredom. Secondly, the critter only mentions how bored it is - make your critter more expressive by having it mention how hungry it is as well.

Debugging

C# code debugging.
Debug the C# code (solution.doc) which allows user to delete any existing node whose child nodes are internal nodes. Line code is 160 (2 or 3 lines of code). I get stock overflow when I try to remove Node 19. Can you take a look?
Also, write something about the error and how did you fix it. Thanks.

Physics programming on electrical fields

The assignment would consist of creating a program in VPython that will place eight 1-nC charges at the following coordinates (in meters): <0,0,0>, <0,0,1>, <0,1,0>, <0,1,1>, <1,0,0>, <1,0,1>, <1,1,0>, and <1,1,1>. It will then ask for the x, y, and z coordinates of a point in space. The program should then draw arrows (of the same length) from each charge toward <x,y,z>. Finally, the program should output the total electric field at <x,y,z>.