c# programming exercises

Alibabacloud.com offers a wide variety of articles about c# programming exercises, easily find your c# programming exercises information here online.

OpenJudge exercises (C ++) -- question 4074: Water Accumulation

OpenJudge exercises (C ++) -- question 4074: Water AccumulationQuestion: Total time limit: 1000 ms memory limit: 65536kB Description The uneven ground always accumulates water when it rains. Assume that the ground is one-dimensional, each piece of width is 1, and the height is a non-negative integer, you can use an array to express a piece of ground. For example, [,] can be used to repr

OpenJudge exercises (C ++) -- question 4040: Book Purchasing

OpenJudge exercises (C ++) -- question 4040: Book PurchasingQuestion: Total time limit: 1000 ms Memory limit: 65536kB Description An online bookstore offers two discount strategies. Policy 1: free shipping is available if the total amount of books purchased exceeds 100 yuan. Policy 2: If the number of books to be bought is greater than 3, the total amount o

C Language Exercises

SubString#include intSubString (Char* Sseek,Char*SKey) { Char* p =Sseek; while(*p! =' /') { intFlag =1; Char* PKey =SKey; Char* Ptarget =p; while((*pkey! =' /') (*ptarget!=' /')) { if(*pkey! = *ptarget) {Flag=0; Break; } //---------------------------------------pkey++; Ptarget++; } if(1==flag) {puts (p); return(P-Sseek); } //---------------------------------------p++; } return-1;}intMainintargcChar**argv) { Char* skey="people"; C

Learn C language and do exercises

/*Write a function whose function is to reverse the input string. In a complete application that uses a looping statement to provide input for this functionTest in the program.*/#include #include void Fanxu (char *zf); Inverse order functionint main (void){Char a[80];Do{Gets (a);Fanxu (a);printf ("Whether to continue (y/n):");Gets (a);} while (*a! = ' n ');return 0;}/*//Method One:void Fanxu (char *zf){Char *pc;PC = ZF;while (*++PC){Continue}pc--;while (PC >= ZF){Putchar (*PC);pc--;}Putchar (' \

Learn C language to do exercises? The number of characters in the statistics file

Number of characters in the statistics file (with command line arguments)#include #include int main (int argc, char *argv[]){Char ch;FILE *FP;Long count=0;if (argc!=2){printf ("File name is:%s\n", argv[0]);Exit (Exit_failure);}if ((Fp=fopen (argv[1], "r+") ==null){fprintf (stderr, "Cannot open file \"%s\ "\ n", argv[1]);Exit (Exit_failure);}while ((CH=GETC (FP))!=eof){PUTC (ch,stdout);++count;}Fclose (FP);printf ("File%s has%ld characters\n", argv[1],count);return 0;}Number of characters in the

C Two-dimensional array exercises

populate in a two-dimensional array */ intColums,rows; for(rows =0; rows for(colums =0; Colums "%d", matrix[rows][colums]);//This can also be written here //scanf ("%d", matrix[rows]+colums);} }/** * Find the smallest element of the largest element * */ //To hold the smallest element in the largest element intMininmax =0; for(rows =0; rows //To save the maximum line element intMaxinline =0; for(colums =0; colums if(Matrix[rows][colums] > Maxinline) maxinline = Mat

"C + +" recursion after class exercises 3-13, 3-14

//// main.cpp// 3-13递归Fibonacci级数//// Created by T.P on 2018/3/21.// Copyright ? 2018年 T.P. All rights reserved.////课本习题3-13.用递归的方法编写函数求Fibonacci级数,//公式为:Fn=Fn-1 + Fn-2 (n>2),F1=F2=1#include //// main.cpp// 3-14递归n阶勒让德多项式//// Created by T.P on 2018/3/21.// Copyright ? 2018年 T.P. All rights reserved.////课本习题3-14//Pn(x)=1, n=0// =x, n=1// =[(2n-1)x*Pn-1(x)-(n-1)Pn-2(x)]/n ,n>1#include "C + +" recursion after class

ur c exercises

The C of Ur is SXBK.UR2: There is a root tree divided into a bare topic, the complexity of metaphysics $O (N\sqrt{n}) $.First, the number of multiples of the statistic K is converted.The path of the center of gravity c is divided into two cases: (setting n is the size of the current tree)1, in the sub-tree of C, direct O (n) calculation;2, one in the subtree of

"Original" "Introduction to Algorithms" link list chapter with star exercises--C language implementation

function and find the function code withheld. Here is the main function test code, which compiles through Windows GCC and outputs the correct results:IntMain (void)//programmed by wmydx{Double_train test;Double_train *l = test;l->length = 0;L->head = NULL; C is not object-oriented and therefore cannot be initialized with a constructor function.for (int i = 0;i {Insert (L,i);}View (L);System ("pause");}So how do you flip a linked list in O (1) time? Y

C language--several exercises

} the return 0; +}# # #7. calculates the total width of an array of English, numeric, and punctuation characters, where the width of the English character is1cm, the digital width is 0.5cm, thepunctuation mark width is 0.8cm. 8. Add the question , if the width of the specified line is 10cm, a character length of more than a string truncation , just so that the width of the 10cm line can accommodate. Output this truncated sub-array. 1 floatGetcharacterweidth (Charc)2 {3 if((

4, C # basic finishing (if statement classic exercises)

{Console.WriteLine ("Input Error");}4, input a,b,c, to find the solution of a two-time equationConsole.WriteLine ("Please enter A,b,c"); intA =int. Parse (Console.ReadLine ()); intb =int. Parse (Console.ReadLine ()); intc =int. Parse (Console.ReadLine ()); if(A = =0 B! =0) { Doublex = (Double) (-C)/b; Con

C-language array and function instance exercises

() - { + inta[Ten]={1,2,3,4,5,6,7,8,9,Ten}; - intx; + intLoc; Aprintf"Please enter a number:"); atscanf"%d",x); -Loc=search (X,a,Ten); - if(loc!=-1) - { -printf"%d is in the first%d locations. \ n", x,loc); -}Else{ inprintf"%d does not exist!"); - } to return 0; +}Two-dimensional array: An array of int a[i][j];//i row J columnsExample 3: Read into a matrix of 3*3, judging 0 and 1 who wins. (Nine Gongge games)2. FunctionsThe functions in

C + + file reading and writing exercises

编写一个程序,统计data.txt文件的行数,并将所有行前加上行号后写到data1.txt文件中。算法提示:行与行之间以回车符分隔,而getline()函数以回车符作为终止符。因此,可以采用getline()函数读取每一行,再用一个变量i计算行数。(1)实现源代码#include#include#include#includeusing namespacestd;intcoutFile(char*filename,char*outfilename){ifstreamfilein;filein.open(filename,ios_base::in);ofstreamfileout;fileout.open(outfilename,ios_base::out);stringstrtemp;intcount=0;while(getline(filein,strtemp)){count++;coutfileout""}filein.close();fileout.close();returncount;}voidmain(){cout"

Simple exercises for C + + combinatorial classes

This is the first time to publish essays on the blog, hoping to urge themselves not to waste time, and strive to improve the basic skills.1#include 2 3 classCPU4 {5 enumcpu_rank{p1=1, P2,P3,P4,P5,P6,P7};6 Public:7CPU () =default;8CPU (enumCpu_rank);9~CPU () {}Ten voidRun () {std::cout"CPU Run";} One voidStop () {std::cout"CPU Stop";} A }; - - enumRam_type {ddr4=1, DDR3,DDR2}; the classRAM - { - enumram_type type; - intsize; + floatPing; - Public: +RAM () =default; ARAM

Statistics of change method for recursive exercises (c + +)

/********************************************************************************* Copyright (C), 1988-1999, Drvivermonkey. Co., Ltd. File name:Author:Driver Monkey version:mail:[emailprotected] qq:196568501 date:2014.04.02 Description : The change method of the recursive practice statistics (c + +) *********************************************************************************/#include Statistics of ch

Go language exercises: The interactive--cgo of the Go language and C language

1. Code1 Package Main2 3Import"FMT"4 /*5 #include 6 #include 7 void Hello ()8 {9 printf ("Hello World!\n");Ten } One */ AImport"C" - - func Hello () { the C.hello (); - } - - +Func Random ()int { - return int(C.random ()) + } A atFunc Seed (iint) { -C.srandom (C.UINT(i)) - } - - Func Main () { -Seed ( -) inFmt. Println ("Random:", Random ()) - Hello () to}2. Operation result677741240!Go language exercises

Analog keyboard entry for C # expansion exercises

of simulating a keyboard entry into letters and numbers, and the characters entered must be defined first in the keycodedic. Analog keyboard input can not be continuously continuous input, if the time of two entry is too short and the content is consistent may cause the latter entry invalid, as shown in line 6.Code Snippet 16-14 Public Static BOOLInput (stringstr) { foreach(CharChinchStr. ToUpper ()) {//The analog click Key can evade or prolong the thread.sleep when the continuous input key

Chapter 9 exercises in C ++ meditation

Chapter 9 exercises in C ++ meditationPaste the code first, and add a summary tomorrow! # Ifndef PICTURE_H # define PICTURE_H # include Using namespace std; class Picture {private: int height, width; char * data; char position (int row, int col) {return data [row * width + col];} char position (int row, int col) const {return data [row * width + col];} static int max (int m, int n) {return m> n? M: n;

C + + Example exercises (2)

voidShow_time (ConstTime Time );Ten Private: One inthour; A intminute; - intsec; - }; the voidTime::set_time (Time Time ) - { -cout"Hour (0-23):"Endl; -Cin>>Time.hour; +ASSERT (time.hour>0time.hour -); - +cout"minute (0-59):"Endl; ACin>>Time.minute; atASSERT (time.minute>0time.minute -); - -cout"second (0-59):"Endl; -Cin>>time.sec; -ASSERT (time.sec>0time.sec -); - } in voidTime::show_time (ConstTime Time ) - { tocout":"":"Endl; + }

The eighth question of C + + exercises

Professor 100 Yuan/hour Associate Professor 80 Yuan/hour lecturer 60 yuan/hour TA 40 yuan/hourEnter the teacher's name, teaching hours, and output the teacher's remuneration#include This topic learns the use of the string type and string (), using this to #includeThis article from "Blue Domain Creeps" blog, declined reprint!The eighth question of C + + exercises

Total Pages: 15 1 .... 11 12 13 14 15 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.