For today's meeting I hope to clarify the file hierarchy for assignment 2. Specifically, I am a little confused about #includes, and how linking will occur with all the .cpp and .h classes separated in they're own folders.
I also have questions about what state the .cpp and .h files should be in. Many of the descriptions for assignment 2 classes listed on the wiki are incomplete, or no description at all.
My mind will be at ease once I am sure all the files are placed where they should be, and we get a proper build.
Thursday, October 29, 2009
Wednesday, October 28, 2009
SVN discussion and summary
Our first meeting with Fardad about the OOP344 Assignment 2 was on Tuesday October 27, 2009 at 17:00. Our team experienced a few problems with SVN. A summary, and an edited transcription can be found at the following link...
http://zenit.senecac.on.ca/wiki/index.php/OOP344_Team_Funktion
http://zenit.senecac.on.ca/wiki/index.php/OOP344_Team_Funktion
Tuesday, October 20, 2009
c validate input/trailing characters
/* A simple program to demonstrate
* a way of validating input.
* By: Ljubomir Gorscak
* October 2009
*/
#include
int clear_input(void);
double validate(void);
main(){
double a;
double b;
double c;
int check = 0;
printf("give me price a: ");
a = validate();
printf("give me price b: ");
b = validate();
printf("give me price c: ");
c = validate();
printf("$%.2lf\n", a);
printf("$%.2lf\n", b);
printf("$%.2lf\n", c);
}
double validate(void){
double num;
int check;
do{
scanf("%lf", &num);
check = clear_input();
if (check > 0){
printf("Trailing characters are bad!\n");
printf("Please try again: ");
}
else if (num <= 0){
printf("Value must be greater than 0!\n");
printf("Please try again: ");
}
}while (check > 0 || num <= 0);
return num;
}
int clear_input(void){
int i = 0;
while (getchar() != '\n'){
i++;
}
return i;
}
/* end */
* a way of validating input.
* By: Ljubomir Gorscak
* October 2009
*/
#include
int clear_input(void);
double validate(void);
main(){
double a;
double b;
double c;
int check = 0;
printf("give me price a: ");
a = validate();
printf("give me price b: ");
b = validate();
printf("give me price c: ");
c = validate();
printf("$%.2lf\n", a);
printf("$%.2lf\n", b);
printf("$%.2lf\n", c);
}
double validate(void){
double num;
int check;
do{
scanf("%lf", &num);
check = clear_input();
if (check > 0){
printf("Trailing characters are bad!\n");
printf("Please try again: ");
}
else if (num <= 0){
printf("Value must be greater than 0!\n");
printf("Please try again: ");
}
}while (check > 0 || num <= 0);
return num;
}
int clear_input(void){
int i = 0;
while (getchar() != '\n'){
i++;
}
return i;
}
/* end */
Wednesday, October 14, 2009
OOP344 assignment 1 - To compile on mac
This entire post can be copy/pasted into your ciol.h between
# if PLATFORM == PLT_LNX
and
# elif PLATFORM == PLT_BCC || PLATFORM == PLT_VCC
Notes are included in the commented-out area. Code starts here...
# elif PLATFORM == PLT_MAC
/*
To compile on mac:
Adding the line
#define NULL 0
fixed an error on mac that said
"NULL not defined"
be sure to #include inside ciol.c
eg.
# if PLATFORM == PLT_LNX
#include
# elif PLATFORM == PLT_MAC
#include
The message that I used to compile:
gcc as1tester.c ciol.c -lcurses
I got the following warnings when I compiled, but it still works.
ciol.c: In function ‘io_edit’:
ciol.c:185: warning: incompatible implicit declaration of built-in function ‘malloc’
ciol.c: In function ‘io_displayMenuItem’:
ciol.c:444: warning: passing argument 1 of ‘io_strlen’ discards qualifiers from pointer target type
ciol.c:445: warning: passing argument 1 of ‘io_strlen’ discards qualifiers from pointer target type
ciol.c: In function ‘io_menuItem’:
ciol.c:467: warning: assignment makes pointer from integer without a cast
ciol.c:470: warning: passing argument 6 of ‘io_displayMenuItem’ makes integer from pointer without a cast
ciol.c:475: warning: assignment makes pointer from integer without a cast
ciol.c:476: warning: passing argument 6 of ‘io_displayMenuItem’ makes integer from pointer without a cast
There are some strange looking characters in some of the strings
output by main. I will be investigating it.
The macbook pro does not have all the dedicated keys that
a full keyboard would have. I made a substitute key mapping
using modifier keys like [shift] and [option]. A chart, and
the key_codes are listed below.
Some useful PLT_MAC key combinations:
F1_KEY = [option] + [F1]
F2_KEY = [option] + [F2]
F3_KEY = [option] + [F3]
F4_KEY = [option] + [F4]
F5_KEY = [option] + [F5]
F6_KEY = [option] + [F6]
F7_KEY = [option] + [F7]
F8_KEY = [option] + [F8]
F9_KEY = [option] + [F9]
F10_KEY = [option] + [F10]
F11_KEY = [option] + [F11]
F12_KEY = [option] + [F12]
INSERT_KEY = [shift] + [option] + [I]
HOME_KEY = [shift] + [option] + [H]
END_KEY = [shift] + [option] + [E]
PGUP_KEY = [shift] + [option] + [U]
PGDN_KEY = [shift] + [option] + [D]
BS_KEY = [delete]
DEL_KEY = [fn] + [delete]
*/
#define UP_KEY 259
#define DOWN_KEY 258
#define LEFT_KEY 260
#define RIGHT_KEY 261
#define PGUP_KEY 168
#define PGDN_KEY 142
#define ENTER_KEY 10
#define TAB_KEY 9
#define BACKSPACE_KEY 127
#define DEL_KEY 330
#define HOME_KEY 147
#define END_KEY 180
#define ESCAPE_KEY 27
#define INSERT_KEY 134
#define F1_KEY 270
#define F2_KEY 271
#define F3_KEY 272
#define F4_KEY 273
#define F5_KEY 274
#define F6_KEY 275
#define F7_KEY 276
#define F8_KEY 277
#define F9_KEY 278
#define F10_KEY 279
#define F11_KEY 280
#define F12_KEY 281
# if PLATFORM == PLT_LNX
and
# elif PLATFORM == PLT_BCC || PLATFORM == PLT_VCC
Notes are included in the commented-out area. Code starts here...
# elif PLATFORM == PLT_MAC
/*
To compile on mac:
Adding the line
#define NULL 0
fixed an error on mac that said
"NULL not defined"
be sure to #include
eg.
# if PLATFORM == PLT_LNX
#include
# elif PLATFORM == PLT_MAC
#include
The message that I used to compile:
gcc as1tester.c ciol.c -lcurses
I got the following warnings when I compiled, but it still works.
ciol.c: In function ‘io_edit’:
ciol.c:185: warning: incompatible implicit declaration of built-in function ‘malloc’
ciol.c: In function ‘io_displayMenuItem’:
ciol.c:444: warning: passing argument 1 of ‘io_strlen’ discards qualifiers from pointer target type
ciol.c:445: warning: passing argument 1 of ‘io_strlen’ discards qualifiers from pointer target type
ciol.c: In function ‘io_menuItem’:
ciol.c:467: warning: assignment makes pointer from integer without a cast
ciol.c:470: warning: passing argument 6 of ‘io_displayMenuItem’ makes integer from pointer without a cast
ciol.c:475: warning: assignment makes pointer from integer without a cast
ciol.c:476: warning: passing argument 6 of ‘io_displayMenuItem’ makes integer from pointer without a cast
There are some strange looking characters in some of the strings
output by main. I will be investigating it.
The macbook pro does not have all the dedicated keys that
a full keyboard would have. I made a substitute key mapping
using modifier keys like [shift] and [option]. A chart, and
the key_codes are listed below.
Some useful PLT_MAC key combinations:
F1_KEY = [option] + [F1]
F2_KEY = [option] + [F2]
F3_KEY = [option] + [F3]
F4_KEY = [option] + [F4]
F5_KEY = [option] + [F5]
F6_KEY = [option] + [F6]
F7_KEY = [option] + [F7]
F8_KEY = [option] + [F8]
F9_KEY = [option] + [F9]
F10_KEY = [option] + [F10]
F11_KEY = [option] + [F11]
F12_KEY = [option] + [F12]
INSERT_KEY = [shift] + [option] + [I]
HOME_KEY = [shift] + [option] + [H]
END_KEY = [shift] + [option] + [E]
PGUP_KEY = [shift] + [option] + [U]
PGDN_KEY = [shift] + [option] + [D]
BS_KEY = [delete]
DEL_KEY = [fn] + [delete]
*/
#define UP_KEY 259
#define DOWN_KEY 258
#define LEFT_KEY 260
#define RIGHT_KEY 261
#define PGUP_KEY 168
#define PGDN_KEY 142
#define ENTER_KEY 10
#define TAB_KEY 9
#define BACKSPACE_KEY 127
#define DEL_KEY 330
#define HOME_KEY 147
#define END_KEY 180
#define ESCAPE_KEY 27
#define INSERT_KEY 134
#define F1_KEY 270
#define F2_KEY 271
#define F3_KEY 272
#define F4_KEY 273
#define F5_KEY 274
#define F6_KEY 275
#define F7_KEY 276
#define F8_KEY 277
#define F9_KEY 278
#define F10_KEY 279
#define F11_KEY 280
#define F12_KEY 281
Subscribe to:
Posts (Atom)
