MockingNerd


Joined 1 year ago
Homeworks submitted:
Homework comments:
3
0

About Me

No description provided.

Classes

Survey of Artificial Intelligence

Class status: Under Construction
Role: Student
. 0% complete

Learning Vim from the inside

Class status: Established
Role: Student
. 0% complete

Programming in C

Class status: Established
Role: Student
. 6% complete

Submitted Assignments

Programming in C: Lesson 1, HW 3
/*
 *	Programming in C
 *		Exercise 1-5
 *
 *	Date:
 *		05/02/2011
 *
 *	Description:
 *		Displays a Fehrenheit-Celsius table
 *		from 300 - 0 degrees
 *
 *	Build:
 *		gcc temp.c
 */
 
 #include <stdio.h>
 
 main()
 {
	/* table heading */
	printf("Celsius%8cFehrenheit\n", ' ');
	int ndx;
	for(ndx = 0; ndx < 25; ndx++)
		printf("_");
	printf("\n");
	
	/* print the table */
	float i;
	for(i = 300; i >= 0; i -= 20)
		printf("%3c%3.0f%10c%6.1f\n", ' ', i, ' ', (5.0 / 9.0) * (i - 32.0));
 }

MockingNerd 1 year ago
Programming in C: Lesson 1, HW 2
/*
 *	Programming in C
 *		Exercise 1-3
 *
 *	Date:
 *		05/02/2011
 *
 *	Description:
 *		Displays a Fehrenheit-Celsius table
 *		from 0 - 300 degrees
 *
 *	Build:
 *		gcc temp.c
 */
 
 #include <stdio.h>
 
 main()
 {
	float fahr, celsius;
	int lower, upper, step;
	
	lower = 0;		/* lower limit of temperature table */
	upper = 300; 	/* upper limit */
	step = 20;		/* step size */
	
	/* table heading */
	printf("Fehrenheit\tCelsius\n");
	int ndx;		/* index used for iterating in header loops */
	ndx = 0;
	while(ndx < 25)
	{
		printf("_");
		ndx += 1;
	}
	
	printf("\n");	/* finish the previous line with with a line feed*/
	
	/* print the table */
	fahr = lower;
	while(fahr <= upper) {
		celsius = (5.0 / 9.0) * (fahr - 32);
		printf("%3c%3.0f%10c%6.1f\n", ' ', fahr, ' ', celsius);
		fahr = fahr + step;
	}
 }

/*
 *	Programming in C
 *		Exercise 1-4
 *
 *	Date:
 *		05/02/2011
 *
 *	Description:
 *		Displays a Celsius-Fehrenheit table
 *		from 0 - 300 degrees
 *
 *	Build:
 *		gcc temp.c
 */
 
 #include <stdio.h>
 
 main()
 {
	float fahr, celsius;
	int lower, upper, step;
	
	lower = 0;		/* lower limit of temperature table */
	upper = 300; 	/* upper limit */
	step = 20;		/* step size */
	
	/* table heading */
	printf("Celsius%8cFehrenheit\n", ' ');
	int ndx;		/* index used for iterating in header loops */
	ndx = 0;
	while(ndx < 25)
	{
		printf("_");
		ndx += 1;
	}
	
	printf("\n");	/* finish the previous line with with a line feed*/
	
	/* print the table */
	celsius = lower;
	while(celsius <= upper) {
		fahr = 32.0 + (9.0 / 5.0) * celsius;
		printf("%3c%3.0f%10c%6.1f\n", ' ', celsius, ' ', fahr);
		celsius = celsius + step;
	}
 }

MockingNerd 1 year ago
Programming in C: Lesson 1, HW 1

Using Windows 7 and the PowerShell console with CygWin 1.7.9-1

  • Exercise 1-1: Compiled and executed without issue.
  • Exercise 1-2: Replaced 'n' with the following results -

    'c' > hello.c:19:9: warning: unknown escape sequence 'c'

    'f' > Compiled and executed without errror, did not produce line feed following the text "Hello, World!"

/*
 *	Programming in C
 *		Exercise 1-1
 *
 *	Date:
 *		05/02/2011
 *
 *	Description:
 *		Displays the text "Hello, World!" 
 *
 *	Build:
 *		gcc hello.c
 */
 
 #include <stdio.h>
 
 main()
 {
	printf("Hello, World!\n");
 }

MockingNerd 1 year ago