Open main menu

CDOT Wiki β

Changes

Assignment 1 (Fall 2013) Q & A

3,842 bytes added, 21:08, 29 September 2013
no edit summary
on the screen, since such displays limit the programmer's ability to design their own screen layouts.</pre>
Q7: Can we use the <ctring> library memmove() function to insert a character to the string?(team 3-Norbert)*Answer: yes you can use it. The following example is from the http://www.cplusplus.com/reference/cstring/memmove/ If you want to know more about the memmove() please visit the website.
<pre>Syntax
 
void * memmove ( void * destination, const void * source, size_t num );
 
/* memmove example */
#include <stdio.h>
#include <string.h>
 
int main ()
{
char str[] = "memmove can be very useful......";
memmove (str+20,str+15,11);
puts (str);
return 0;
}
 
Output:
 
memmove can be very very useful.</pre>
 
Q8: What is the purpose and functionality of the "strOffset" parameter? This explanation is confusing: "strOffset points to an int variable that holds the initial offset of the string within the field; that is, the index of the character in the string that initially occupies the first character position in the field." Please answer it in simpler terms, maybe with an example as well. -- Fries'n'burg
* The 'strOffset' allows the string to be moved if the fieldlength is shorter than a string itself and the cursor is beyond the string. To do that it points to a int value which is the index of the string. i.e if the string is "abcdefghi" and the field length is 5, the string will be shown as "abcde"; when you move the cursor beyond 'e' it should display "bcdef" and so on. Hopefully this helps. -(Team 2)
* Take a look at the diagram that we posted below - it helped us understand how this works (Team 4)
 
'''Q:''' What is the difference between '''consolelineedit.h''' and '''consoleplus.h''' ? <br> '''Submitted by:''' Rafid Daoud and Arnold Goncharenko, Team 8
* There is no file named consolelineedit.h. There is only consoleplus.h in which all your prototype functions are declared.(Team 2)
 
Q10: Whenever we try to compile our program, we get a large amount of errors from console.cpp, all of which are undefined references such as: '''console.cpp:(.text+0x7): undefined reference to `initscr''''What is causing these and how do we fix it? None of the files other than consolelineedit.cpp and consoleplus.h have been edited.
*On Matrix try compiling with -lncurses. Do g++ a1test.cpp console.cpp consolelinedit.cpp -lncurses. This should work. (Team2)
 
'''Q11: Can anyone clarify the submission requirements for this Assignment? I included the sections that I don't understand.(Team 4)'''
 
Prepare a matrix typescript named a1.txt that includes
 
* a listing of your consoleplus.h file
* a listing of your consolelineedit.cpp file
* a compilation and linking of console.cpp and consolelineedit.h with a1test.cpp '''- *compile it....'''
* a listing of your application file - '''**??? what does this mean?'''
* a compilation and linking of console.cpp and consolelineedit.h with your application file '''- **??? what does this mean?'''
** Answer: g++ myapplication.cpp ... (Peter Liu)
 
Upload two individual reports and a zip file to Blackboard:
 
* a1.txt
* a screen shot of the result of a run of a1test.cpp on each of the platforms listed above '''''- ?? how is different from the one below it ???''?'''
** Answer: It's the screenshot of running a1test.cpp. (Peter Liu)
* a screen shot of the result of a run of your application on one of the platforms listed above
** Answer: It's the screenshot of your own application program. (Peter Liu)
'''***Where do I find the requirements for this application program? (Jodie Carleton)'''
 
 
Q12: HINT - When following the instructions and you get to the Line that says <u>'''Press C, End, Backspace 4 times, 1, 2, Home, Enter'''</u> it '''MEANS to change the lower case c to an UPPER case C''' (Team 4)
* nevermind, realized the cursor is suppose to start off at the letter c (index = 2)
 
Q13: Wondering why in the a1test.cpp the in and out strings are the same, is that supposed to be the case? since the instructions tell you to change it back shouldn't it be different?
 
*Answer: when you Escape it should revert the string back to the original string. Then it compares the to make sure the string is unchanged which is testing that your escape button is working properly. (Team 4)
This will allow the buttons such as 'Home','END', etc to work properly when testing/compiling.
Q8: What is * USEFUL DIAGRAM - we found this posted from a previous class... we found it helpful to help understand the purpose curPosition and functionality of the "strOffset" parameter? This explanation is confusing(Team 4)[[Image: "strOffset points to an int variable that holds the initial offset of the string within the field; that is, the index of the character in the string that initially occupies the first character position in the fieldA1_Diagram." Please answer it in simpler terms, maybe with an example as well. -- Fries'n'burgpng|thumb|1000px| ]]
1
edit