Share
Explore BrainMass

C

C is a general-purpose programming language created in the late 60s and early 70s in Bell Labs.

 

Dennis Ritchie, creator of C and, with Ken Thompson, Unix, wearing his National Medal of Technology awarded by President Clinton

 

In keeping with ALGOL tradition, C's design centers around structured programming, utillizing recursion, lexical variable scope and a static typing system which prevents many common typing errors programmers can make. C's strength and staying power in industry stems from its structure mapping so well onto typical machine instructions, thus it can be used instead of, or rewritten from, very low-level assembly language. Perhaps C's greatest application so far is its use in the system software of the Unix operating system. This has helped make it one of the most widely-used programming language of all time, and although C++ is more common in many place today, C is still a staple that is taught in most computer science degree programs.

Other effects of the popularity of C is that almost all computer architectures and operating systems support it by having an efficient compiler ready for C programs. C has also provided a basis for many new, more specialized languages such as C#, D, Go, Rust, Java, JavaScript, Limbo, LPC, Perl, PHP, Python and more, both in syntax and concepts. This has helped unify programming languages to some extent; even though a language's type systems, data, models, and semantics may be radically varied, many basic expressions and statements are recognizable to a decently fluent programmer across languages thanks to the C base.

C is a fairly low-level language, as languages go, but this gives the user more control as to how they manage their memory, etc. and can result in faster programs than something like Java which takes care of these details 'behind the curtain'. In addition, the straightforwardness of most C compilers make it easy to program something that will run on many platforms (which was a goal in designing C) and require minimal run-time support, which programmers everywhere are sure to appreciate. 

 

Icon photo is the cover of The C Programming Language (also known as the C Bible and K&R), authored by Brian Kernighan and Dennis Ritchie. Photo credit Julesmazur.

Simulating a Guessing Game, Two Players Against the Computer

Guess My Number (High-Low) Two Players Take Their Turn Create a program that will simulate the child's number guessing game with two players who will play against the computer. The program should have the following requirements: 1. When the program is invoked the computer will pseudorandomly choose which player will go fir

C Language: User defined functions

Using C visual express write a function that: // gets an integer from the user and returns it // make 3 calls to this function: // 1.. To get the radius of the circle from the user and return it to main // 2.. To get the length of the rectangle from the user and return it to main // 3.. To get the width of the rectangle

Insertion Sort and Selection Sort Using C

Implement insertion sort and selection sort using C programming language: 1. Generate an array of random integers to be sorted using either insertion sort or selection sort. 2. Allow the user to specify the number of integers in the array to be sorted in the main function. 3. Allow the user to specify the range of random i

2D Array in C to Generate Report for a Service Calls Company

2 dimensional arrays Service Calls Company Report Service Calls Company Report The Service Handlers Company handles daily service calls (phone calls) from customers. The company handles clients' problems over the phone. The company needs to generate a a summary on the calls made in a given month. The data collected is eac

Write a C Program that Will Calculate the Pay for Employees

I am looking for help with my class assignment for C Programming. I need to write a program that will calculate weekly pay for employees. For each employee the program should prompt the user to enter the clock number, wage rate, and number of hours. The clock number is a unique identifier for an employee, the wage rate is the

Use of functions in C for a teller machine

I am new at this programming stuff, and functions are confusing to me. I think what I do is replace some of the text from tutorial 5 with functions, but not quite grasping what to do. I have, and will, continue to read more about these to further try to understand this. I practiced some more with what I learned in tutorial 5, an

C Program for Simple Banking Transactions

Please take a look at what I have for this problem and offer up what I am doing wrong on why I can't seem to get this to look like the output. I know that it has some to do with the if else statements. Please help. I am enclosing what I have and what the output should be. Thanks!

C Programming with Division Operation

See attachment below. I can get the introductory statements to print, but the sum, difference, and product all produce a result of 0 and the quotient statement of: When 22 is divided by 16 you get 1 with a remainder of 1. Also, the two closing statements of "If you had 22 nickels and 16 pennies you would have $1.26" doesn't

Complete C Code for Calculating Total Currency

I have been working on this tutorial for awhile now. I will state what the output should look like. My program will do some computation with two numbers. The two numbers used by this program are 22 and 16. The Sum of 22 and 16 is 61 The Difference of 22 minus 16 is 11 The Product of 22 times 16 is 900 When 22 is divide

The solution gives a complete c++ program on calculating the stress and strain in a steel rod of diameter D (inches) and length L (inches) subject to the compression loads. Explainations are added after some important codes. A screenshot of output is also given.

Write a main function and the following functions to compute the stress and strain in a steel rod of diameter D (inches) and length L (inches) subject to the compression loads p of 10,000 to 1,000,000 pounds in increments of 100,000 pounds. The modulus of elasticity E for steel is 30 x 10 with an exponent of 6. A function to co

The solution gives a complete C program on computing the diameters of steel rod, aluminum rod, and copper rod using the given formula. The output of the program is also provided for reference.

A program to compute the diameter in centimeters of steel rod, and aluminum rod, and a copper rod, which can withstand a particular compression load. The allowable compression stress of steel, aluminum, and copper is 25,000 lbs/m², 15,000 lbs/m², and 20,000 lbs/m², respectively. Area of rod = compression load ______

What is the personnel shortfall during weeks 5 and 6?

Using the chart given in the attachment(Personnel_Shortfall.docx), with durations shown in weeks, if there are 16 total people available for the project (assume all 16 are qualified to work on any of the tasks and assume all tasks start and finish at their earliest times), what is the personnel shortfall during weeks 5 and 6?

List Program C++

You are to implement a 'List' class to handle a list with general operations. That means you can insert and delete any element anywhere in the list. The list has no order, except for the order you insert or delete. The methods you are to implement are as given: Constructor methods (two, default and copy constructor, a list to

Discrete Mathematics and Functions

See the attached file. 1. Let f be any function from R to R. Define a relation Rf by the rule: x Rf y if and only if f(x) = f(y). Show that Rf is an equivalence relation. (Hint 1: first consider a simple specific case, such as f(x) = x2. That is, x and y are related if and only if x2 = y2. Then consider the general case. H

Is this a #define issue?

The following code fragment produces the correct result sometimes and sometimes it does not. Explain what is happening and why. #include <stdio.h> #define max(a,b) ((a) > (b) ? (a): (b)) void main(void) { int i = 0; int j = 0; int a = 3; int b = 4; int c = 6; int d = 5; i = max(a,b); j = max(c,d); printf("i = %i,

Programming with C: Loops

Create a program that asks the user to enter a number from 1 to 50. Print the statement "Programming is fun" the number of times entered by the user using a for loop. Print the statement "Spring break is fun" the same number of times using a while loop.

Introduction to C - Conditionals and Basic Functions

1. Given the variables isFullTimeStudent and age , write an expression that evaluates to true if age is less than 19 or isFullTimeStudent is true. 2.Write an expression that evaluates to true if and only if value of the integer variable isAMember is false. 3. Write a conditional that assigns true ( 1 ) to the varia

Introduction to C - Swapping and Toggling

1 Given two int variables, i and j , which have been declared and initialized, and two other int variables, itemp and jtemp , which have been declared, write some code that swaps the values in i and j by copying their values to itemp and jtemp , respectively, and then copying itemp and jtemp to j and i , respective

C Program to Execute a Problem

Please use C only and be clear about the steps. // use user-defined functions // (calculates different sales tax based on an item price) 1. Ask the user to enter the price of an item. 2. Get the item price from the user. 3. Calculate the sales tax of the item: - 6.5% if the item costs less than $100. - 5% if th

using functions in C

see attached...rewrite the program shown using functions per the direction....please use C and keep it simple. please make sure the program will run on C

Program in C to Test Students

We have to use rand() to get 2 numbers in random each time and ask student to find the correct solution.. First we start with numbers 1 to 6.If we get 4 and 5 then the program will ask "how much is 4 times 5 4x5 = " Then the student will be able to give the answer, If it is correct then it will be typed on screen "Correct" other

Introduction to C

Bob, My attempt resulted in the statement below and I am not sure were the prob is; also i have a small green rectangle on the field that preceds the cursur when i enter the code. This rectangle does not appear in your notes...any suggestions? //header #include<stdio.h> int main (void) { printf( "Hello Chuck/n" )

PROGRAMMING ESSENTIAL

Written Assignment: Grade Book Program Your English instructor, realizing you are a programmer, asks you to write a Grade Book program for his class to help him compute final grades. Design a program that asks for the student’s name and four test grades. You are to display the student’s name, four test grades, the average o

Write a declaration to store the string in an array

Write a declaration to store the string "This is a sample" in an array named samtest. Include the declaration in a program that displays the values in samtest in a for loop that uses a pointer to access each element in the array.

Grade Book Program Algorithm to Compute Final Grades

Your English instructor, realizing you are a programmer, asks you to write a Grade Book program for his class to help him compute final grades. Design a program that asks for the student's name and four test grades. Display the student's name, four test grades, the average of the four test grades and the final letter grade the s

Writing Strings and Integers in C Programs

I am trying to write a C program that accepts a string and two integer numbers from a user. Each of these inputs should be preceded by a prompt and stored using individual variable names. Then I am trying to have the program call a function that assembles the input data into a single string, then display the assembled string

A simple C program to separate words by spaces

Write a C program that accepts a string of characters from a terminal and displays the string one word per line. Make your array 80 characters and assume the entered text will be less than 80 characters. A complete C program is included as well as a description of how the program works.

Chess game in C language

Create table game characters 8x8, where will store THE POSITION OF Figure each time on this chessboard. The creation of the list must be made with commitment memory. In addition create structure (struct move) to be used for the registration movements with the elements: CHAR OVER, char prevpos[2], char nexpos[2], move *next,

A simple example of two-dimensional arrays in C

Write a C function that adds the values of all elements in a two-dimensional array that is passed to the function, Assume that the array is an array of double-precision numbers having 4 rows and 5 columns.