Example of C language program for calculating Pi

Code:# IncludeLong a = 10000, B, c = 2800, d, e, f [2801], g;Main (){For (; B-c ;)F [B ++] = a/5;For (; d = 0, g = c * 2; c-= 14, printf (%. 4d, e + d/a), e = d %)For (B = c; d + = f [B] * a, f [B] = d % -- g, d/= g --, -- B; d * = B );}The output

C language Problem 201703_guess

      A complete explanation of the original question is as follows: Description A competition was just over. It had 3 problems and n players. Eachplayer had an ID number from 1 to n.? Nal rank wasdecided by the total score of the 3 problems. the

Solution notes-enter a binary search tree to convert the tree to its image

Problem description: enter a binary search tree to convert the tree to its image, that is, in the converted binary search tree, the left subtree has more nodes than the right subtree. Use recursive and cyclic methods to convert tree images. For

Random_n in C Language

  Some data is always input manually during algorithm sorting, which is somewhat inconvenient and acceptable for small data input. However, when the data volume reaches K level, it becomes complex. We also need to ensure that the input data is not

Number of super-long digits processed

  Float and double data types are single-precision and double-precision data types. Their values are respectively from the negative power of 3.4E + 10 to the 38 power of 3.4E + 10, and the negative 308 power of 1.7E + 10 to the 308 power of 1.7E + 10

C string function Summary

4. memccpy Prototype: extern void * memccpy (void * dest, void * src, unsigned char ch, unsigned int count ); Usage: # include  Function: the data is copied from the memory area indicated by src to the memory area indicated by dest. If the ch

Major operating system experiment progress (3) ----- number of bytes of common data types in C ++

Char-128 ~ + 127 (1 Byte) short-32767 ~ + 32768 (2 Bytes) unsigned short 0 ~ 65536 (2 Bytes) int-2147483648 ~ + 2147483647 (4 Bytes) unsigned int 0 ~ 4294967295 (4 Bytes) double 1.7*10 ^ 308 (8 Bytes) long (= int)-2147483648 ~ + 2147483647 (4 Bytes)

Question 3: f = 1-1/2 + 1/3-1/4 +... + 1/9

/*************************************** ************************Computer report 1: accumulated (c)AUTHOR: liuyongshuiDATE :************************************************ ***********************//*Question 3: f = 1-1/2 + 1/3-1/4 +... + 1/9 */ #

Miscellaneous PID control algorithms-final article: using C language to implement PID Algorithms in 51 Single-Chip Microcomputer

Unfortunately, the second chapter cannot be published on the homepage. Hit the ground. Send the final article-code. For code design ideas, see the first two articles. // Pid. h # ifndef _ PID __# define _ PID _/* PID = Uk + KP * [E (k)-E (k-1)] + KI

The internal mechanism of main function parameters, argc and argv

Occasionally interested in the parameters of the main function, write a program for verification. Int main (int argc, char ** argv) First, two points are explained: First, the system will store the parameter list, that is, the command we input under

Unix System Programming Summary (1) ------ file I/O

After reading the unix/linux Programming Practice tutorial, I realized a few small projects and felt quite uncomfortable. I didn't talk about the details and principles of many system calls in the book. I found a lot of difficulties when trying to

How to convert DIB to DDB

    First, you do not need to convert DIB to DDB to display it on the device. However, you will see how slow the program is, and you cannot use function functions related to DDB operations, such as BitBlt ()....   The basic steps for creating a

Chapter 6 control statements

Chapter 6 control statementsThere is a statement that you can find in each programming language control flow statement. In this chapter, I introduced the control statements of C #, which are divided into two main parts:. Select statement. Loop

Classical Algorithm Research Series: Part II, Part III, Dijkstra algorithm + Heap complete c implementation source code

Author: JULY, March 18, 2011Source: http://blog.csdn.net/v_july_v.------------------------------------------ Introduction:The purpose of writing this article is very simple. For one reason, I personally think: in the previous article, I continued

A Simple Virtual Machine in C Language

A Simple Virtual Machine with 100 characters of memory, several registers-instruction counters, instruction registers, operation code registers, memory address registers, and accumulation registers. You can -- input 01, output 02, load data to

In-depth exploration of empty Base Class Optimization EBO

I. background of EBOWe know that an empty class contains no non-static data members and no virtual pointers (including pointers to virtual function tables and virtual base class sub-objects ), its size is usually 1. Of course, in some alignment

Null Object Mode-a discussion about the function's need to return a meaningless object or object reference

Recently, I encountered a situation in the program, but I used another method to bypass it. The specific problems are as follows: Const Layer & Frame: GetLayer (uint32 layerIndex) const{If (CheckLayerIndexValid (layerIndex )){Return m_layers

Effective use and design of COM smart Pointers-Preface

PrefaceSince Microsoft announced the COM technology for the first time in 1993, the development model on the Windows platform has undergone great changes. A series of software componentization technologies based on COM have brought Windows

How to get the pointer of the structure through a variable in the structure?

Q: How can I get the pointer of the structure through a variable in the structure ??? For details about container_of, see in kernel. h:/*** Container_of-cast a member of a structure out to the containing structure* @ Ptr: the pointer to the member.*

The 16-bit binary number. Every 4 bits is a number. Write a function to calculate their sum.

Note: If you enter a 10-digit number on the keyboard, the program will automatically convert it into a 16-bit binary number. Then, every four digits is a number, and write the function to calculate their sum. The Code is as follows: Char

Total Pages: 275 1 .... 43 44 45 46 47 .... 275 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.