TRENDING NEWS

POPULAR NEWS

C Programming Concept Question

Question in programming in c?

Your question is hard to answer, as it is not outlining your objective accurately.
I also do have the suspicion that want to address printf's format specifiers and don't understand the syntax of printf very well.

In case your format string would be %3.3lf this would mean the following:
The field length is 3 (first 3 in front of the period)

The number would be formatted with three digits after the decimal point and no fixed width.

In case your object was that you require a number with 3 digits infront of the decimal point and three digits thereafter, then the format string would be %7.3f, meaning: you format a floating point number to have a width of 7digits with space for 3 positions in front of the decimal point and three digits after the decimal point (it would will the digits up with 0s, in case the number had less then three positions after the decimal point (i.e. 3 would format to __3.000).


#include

int main()
{
float data[2][20] = {
{2.3f, 3.3f, 4.3f, 4.1f, 4.2f, 4.3f, 5.2f, 5.2f, 5.1f, 4.3f,
5.2f, 5.7f, 5.8f, 4.5f, 4.8f, 4.9f, 4.2f, 4.1f, 3.4f, 3.9f},
{1.3e3f, 1.2e3f, 1.1e3f, 1.2e3f, 1.1e3f, 1.4e3f, 1.5e3f, 1.3e3f, 1.4e3f, 1.1e3f,
2.1e3f, 2.1e3f, 1.7e3f, 1.8e3f, 1.9e3f, 1.8e3f, 1.7e3f, 1.6e3f, 1.5e3f, 1.6e3f}
};
int i = 0, j = 0;
for (i = 0; i < 2; i++) {
for (j = 0; j < 20; j++) {
if (!i) {
fprintf(stdout, "%3.1lf\n", data[i][j]);
}
else {
fprintf(stdout, "%7.3lf\n", data[i][j]);
}
}
}
return 0;
}

Home Work Question on Problem Solving and Programming Concepts?

#1 pg 90
Complete the seven steps of solution development for the following problems:

A painter wants to know the amount of paint needed to paint only the walls and interior side of the door in a doom. The chosen paint covers 1000 square feet per gallon. There are two windows. Test the problem with the following data:

The room is 12 feet long, 10 feet wide, and 8 feet tall.
The two windows are 5 by 3 feet, and 6 by 2 feet, respectively.

#5 pg 91
Mary Williams need to change a Fahrenheit temperature to Celsius. Use the Fahrenheit temperature of 80 degrees to test your solution.
(Hint: C= 5/9(F-32))

Why i cant understand the logic and concepts behind C programming?

Hi, some suggestions

1) Mathematics is something that I was weak in too, but most programmers will be quick to point out that mathematics isn't really needed to program. The highest mathematics I have come across unless specifically writing so far in my learning is functions and the order of operations. Then again I'm not programming advance 3D games where graphics would require trig functions and calculus for physics engines. The thing about functions is that mathematics influenced programming and this can be seen in it's use of functional programming paradigms.

2) Reddit's "Learn programming" subreddit is your friend. So is Wibits.net video(buy the apps for your phone or watch them free online), along with Stack Exchange(search it for questions). Keep a note book and start learning concepts and writing down. Keep a separate folder of code. There are some really intelligent guys on Y/A answering most of the programming questions take note of their names and follow them so you can read their responses. They tend to fill in the gaps, at least for me.

3) Another idea would be to learn another language that is parallel with C so you can see how C's programming paradigmn is different than say LISP/Scheme.

4) Although heavy, I picked a C primer plus(not to be confused with C ) and it's been helpful. He is creating a new C11 version if you want to wait. Personally, I would get a computer science intro book that uses C so you can learn the machine architecture and manipulate it from gates and up.

5) Keep in mind that software engineering and CS are different topics even though they overlap.

What should I learn completing 'C' Programming Language to start carrier as Programmer?

Companies prefer candidates who are skilled in one or two areas and not who know something here and there.

Thatz better that you ve completed C programming but check out if u r through with concepts like pointers, datastructure programming, memory related programming, bitwise programming, etc in C.

Now if u r throught with that you can go to C++ or Java.

And also study some theoritical concept papers like Operating Systems or Networking Concepts or Datastructure concepts.

Be sure that even if u study one or two be through and confident with that.

. . .
Vasu M

A concept question regarding Java's recursive thinking?

Sorry pal to say this, but this question plays hours with nothing!

There is absolutely no difference between a recursive call and non-recursive call except for the fact that if the stack size is limited (always the case), and recursion occurs above that limit (never to seldom), the recursion would fail somehow,

- There is no issue about the primitive values and reference values in the difference between them.
- There is no issue about turning a reference variable to primitive value or vice versa, as well.
- Local variables are created using a specific data structure called the "stack frame". Each recursion creates its own new stack frame which does not interfere with the older recursion stack frame, and hence, the local variables would not interfere in any form. That is not something based on which a recursive method differs from a non-recursive method because the stack frame is created exactly the same way in both type of methods.

This is not really a nice choice, "None of the above"!

The only really interesting difference is that the recursion looks simpler in code, it offers a substitute for a loop by several self-calls and it is not applicable to in-line expansion (it is an issue in C++, but not in Java and C#).

Turtle graphics in C programming?

Several problems although the initial error is that your second while loop starts with i already set to the end of the array (since the previous loop exits when it reads a 9)

You also dont have any bounds checking, i.e. what happens if I enter 21 codes?

You should replace all the constants (i.e. commands and directions) with an enumerations, makes the code much easier to read

Use functions to remove duplicated code.

You can simplify the direction handling.

TRENDING NEWS