C Language and Program design practice Project--c Language Program first Experience

Source: Internet
Author: User

"Project 1-output bitmap"
Compose a program, use your name to pronounce the initials, make up a similar funny picture
650) this.width=650; "src=" http://img.blog.csdn.net/20150105150643968 "/>
Hint: printf ("... \ n"); The statement outputs the contents of the double quotes, ' \ n ' completes the line break
[Reference Solution]

"Project 2-Complete Simple calculation"
(1) programming, the input rectangle on both sides of the length A and B, the output rectangle circumference and area
Tip: The edge length can be an integer or a decimal, and the operator that implements the multiplication is *
[Reference Solution]


(2) programming, input two resistors R1 and R2 resistance, ask them in parallel after the value R
Tip: The calculation formula is r=1/(1/R1+1/R2)), the resistance value is floating point number
[Reference Solution]


(3) input Celsius temperature value (C), converted to Fahrenheit temperature value (F) and output
Tip: f=cx9/5+32, the temperature value to take the floating point number type.
[Reference Solution]


(4) programming, the input cylinder radius r and High h, the output cylinder surface area S.
Tip: Pi values are directly written 3.1415926
Sample input: 3.5 9
Sample output: area = 274.889343
[Reference Solution]

Item 2 Tip: The program that completes the calculation, its general structure is

#include <stdio.h>int main () {//define required variables//input data//data processing/output result return 0;}



"Item 3-crash exercise"
On the basis of the program that can run correctly, "trouble-making" makes some mistakes, compiles in c::b, observes and records error hints, and accumulates experience of facing errors.

#include <stdio.h>int main () {int a,b,sum;    scanf ("%d%d", &a, &b);    Sum=a+b;    printf ("%d\n", sum); return 0;}

Here are the errors that can be "made":
(1) Sum=a+b the 6th line; Remove the semicolon at the end of the line
(2) the 4th line int a,b,sum; int a, b;
(3) write the 7th line of printf as printf, noting that p and P are different
(4) Sum=a+b the 6th line; Changed to Sum=ab; The plus sign is missing.
(5) Delete the last closing curly brace of the 9th line of the program
(6) The 4th line int a,b,sum; instead of IMT a,b,sum; Note that the small hand may be a shiver, and int becomes IMT.
(7) You are a "bad" "Bad Boy" and think of "messing up" with your teacher.






C Language and Program design practice Project--c Language Program first Experience

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.