Documente Academic
Documente Profesional
Documente Cultură
rite a program to take integer, character, float 7 double values from the user and display the same on the screen. 8or each data type cosider all posible forms like signed, unsigned,long etc. rite a program which takes two integers as input . 2hen program should divide 7 multiply the first integer by the second one. 9t should display the accurate result of division with the decimal values as well as result of multiplication should be properly displayed. rite a program to find the A4C99 value of the inputted character.
3.
:.
Concept: Operators
Estimated time: 1.; Hours Objective: At the end of the assignments, participants will able to use different operators with considering their precedence and associtivity. Prob ems: 1. rite a program to calculate the simple interest with following formula 4imple interest < principle amount $ no. of years $ rate of interest ================================================================= 1,, +. 3. rite a program to find the area and perimeter of the circle. 2ake radius as an input from user. rite a program to solve following mathematical e$pression, c < =b>:ay"+a Accept values of a, b 7 y as integers from user. rite a program to find the ma$imum"minimum of two numbers.
:.
;. 9nput the gender and age of a person and check whether that person is eligible for marriage. *isplay the result. Concept: Conditiona ! o" Estimated time: 1.; Hours Objective: At the end of assignments, participants will able to implement conditional flow using proper use of if=else or switch statements Prob ems: 1. 9nput the four integer numbers and find the largest number without using logical operators. +. 9f cost price and selling price of an item is input through the keyboard, rite a program to determine whether the seller has made the profit or incurred loss. Also determine actual profit"loss. 3. 9nput any integer and find whether it is even or odd. :. rite a program which takes two numbers as input from the user 7 ask for arithmetic operation using following menu, 0enu 1. Addition
+. 4ubtraction 3. 0ultiplication :. *ivision ;. 0od and display the result according to selected menu option. ;. rite a program which will take the integer between 1 and 1+ as an input and will display the corresponding month. *isplay appropriate error message for invalid input.
Day ##:
Concept: $terative ! o" Estimated time: + Hours Objective: At the end of assignments, participants will able to implement iterative flow using loops. Prob ems: 1. 0odify the above menu=driven program !switch assignment 1#, so that it will go on e$ecuting till user e$its it. 5&$it6 should be there in menu. +. rite a program to find sum of n numbers as well as find ma$imum out of these n numbers. Assume certain ma$imum value for n 7 accept these n values from the user. 3. rite a program to calculate overtime pay of 1, employees. ?vertime is paid at the rate of ;,, (s per hour for every hour worked above :, hours. Assume that employees do not work for fractional part of an hour. Accept number of hours worked as input from user, calculate and dsiplay the overtime pay. rite a program, which should calculate nth term of fibonnaci series. 2ake value of n as input from user . /rogram should continiously ask for input and gives the result, till user enters , as an input. 9f user enters negative number, program should give the proper message 7 should continue with asking input to user. @Ase infinite loop 7 continue statementB rite a which takes a character as input and check whether it is alphabet, if not then program should ask for the input again. 2his should be continued till user enters valid alphabet. @Ase break statementB
;.
C.
Objective: At the end of assignment, participnats will able to efficiently use storage classes 7 arrays. 1. +. 3. :. rite a program to take a 1, numbers as input from user 7 find sum of all numbers. @0ake proper use of register 7 auto storage classesB rite a program to sort the inputted n elements in ascending order. rite a program for multiplication of two metrices 7 also give transpose of both the matrices. rite a program to read your name as input from keyboard and count number of characters in your name. Also write the characters in reverse order into another array called backname. Assum that 5name6 7 5backname6, at most contain +, characters.
Day #&:
Concept: 'ser de!ined data types (%truct, 'nion,Enum) Estimated time: 1.; Hours Objective: At the end of the assignments, participants will able to design any user defined data type as per its need. Prob ems: 1. rite a program which takes (oll 'umber,name 7 marks of 1, 4tudents in 3 su-ects. Calculate total marks 7 percentage for all students 7 display the merit list on screen. !make proper use of typedef# +. rite a program which stores information of person as follows, name string gender char !5m6 or 5f6# age int salary float 9t is required that, for all males only salary and for all females only age to be stored by the program. *isplay information of all persons on the screen. 3. rite a program which shouls store data about windows !suppose in certain graphical application# in following format% windowDid title
forecolor backcolor height width here different possible colors are Elack, hite, Fiolet, ?range, (ed, /ink, Green.
Accept data of ; windows from user 7 display all windows which has background white 7 foreground pink.
Day #*:
Concept: Pointers Estimated time: :; minutes Objective: at the end of the assignments, participants will able to do pointer arithmetic, will able to work with pointer to structure. Prob ems: 1. *efine structure 5Eook6 with some attributes like 9*, 'ame, author etc. rite a program which should ask to user about number of books n dynamically. Accept details of n books from user. *isplay the entered information on the screen using pointer to structure. 3. rite a program to accept 1, elements in array. *isplay all these numbers using pointer. *o not use separate pointer for this. Concept: Functions (bui t+in , user de!ined) , Preprocessor Estimated time: + Hours Objective: At the end of the assignments, participants will be able to implement moduler program using functions as well as able to use library functions Prob ems: 1. rite a function which will swap the values of the two variables. /ass the values to the function using pass by value method.
+. Ase the pass by reference method instead of pass by value in above assignment. 3. A ; digit positive integer is entered through the keyboard. rite a function to calculate the sum of digits of this number in your own header file 5mylib.h6. *isplay the result in main function in another file as 5mymain.c6.
:.
rite a program which calculates the factorial of entered number. *esign recursive function to calculate factorial with following prototype, void calcDfact!int n# 2his function should called from main. @0ake proper use of static 7 auto storage classesB
;.
rite a program for matri$ addition. 2here should be separate function getDmatri$! #, addDmatrices! # 7 displayDresult! #. *eclaration of matrices should be local to main function. *ecide appropriate prototype for each function. rite a program which will count the number of vowels present in the inputted string. !Hint% letters a,e,i,o,u,A,&,9,?,A are vowels# rite a program to input the names of the ten employees and sort them alphabetically. rite a program to solve the e$pression $n .Accept values of n 7 $ from the user. @Ase appropriate library function from math.hB
C. H. I.
Day #-:
Concept: Command ine arguments Estimated time: 3, minutes Objective: At the end of the assignments, participants will able to identify the need 7 use command line arguments Prob ems: 1. rite a program, which will take two integers from command line and add them. *isplay the result. +. rite a program ./allindrome.c1, with command line argument as a string. Check whether the passed string is palindrome or not.
Concept: Fi e .and ing Estimated time: + Hours Objective: At the end of the assignments, participants will able to work with character by character reading, writing as well as formatted reading,writing of files.
Prob ems: 1. +. rite a program which will copy one file into another. rite a program which will count the number of lines, words and characters present in the file.
3. rite a program which takes following employee data from user, write it in file, retrieve it back 7 display on screen on screen. &mployee 'o. 'ame 4alary 1 4an-ay /atil 1+,,,.,, + 4an-eev Jumar 13,,,.;, 3 4unil *ev +;,,,.;, == == == == == == Accept an employee id, to be modified 7 modify the information in the file. :. rite a command in C called 5G(&/6 in which the functionality of the grep command in uni$ is simulated, using 8ile handling and command line arguments. &$% G(&/ KpatternL KfilenameL /rints all the lines of the file containing the pattern.
Case %tudies
Case %tudy #1 : On ine /est %ystem
Estimated time: 1.; Hours Create an application in C. 9n an ?nline ?b-ective 2est M where questions and answer options are displayed. ?nly one answer is correct out of all answers. Aser enters the option of the correct answer. All questions 7 options should be stored in form of strings in the program. 2he correct answer key should be also stored in form string.!eg. aaabbbacdab#. /rogram should display the questions and options on the screen 7 accept the correct answers from the user. 8or each correct answer 1 mark 7 for wrong answer , mark should be given. After all the questions are attempted, the score shold displayed on the screen in scorecard form as, Attempted Nuestions% 1, Correct answers% : rong answers% C 4core % : (esult% fail @2ake ;, percent as passing marksB 2est the program with minimum of ; questions.
9nitially mark all numbers in @+, nB as prime. e know that + is a prime, so we output +. 2hen we mark off all the multiples of + as non=prime. 9n the ne$t iteration, we find the smallest number after + not marked as non=prime. 2his will be the ne$t prime after +. 4o, we output this number and mark off all its multiples as non=prime. Note: Ase an array to store whether a number is prime or non=prime.
8irstly the program should display following menu% 0ain menu ============== ?rder food Cancel the order Generate Eill &$it 2he working of each option is as follows% 1. ?rder food % 2o order the food, customer have to choose this option. After customer selects this option, menu=card should be displayed to customer. 9nformation of all items should be e$tracted from array of structures which is already holding this information. 2he format of menu=card may be as follows% % 0&'A CA(* %
9tem=Code 9tem='ame (ate ================================================================================================= 1,,1 9dli=sambar 1+.,, 1,,+ Fada=/av ,;.,, 1,,3 4andwich 1,.,, 1,,: Attappa 1;.,, 1,,; 0asala *osa 1H.,, . . . . . . . . . henever menu=card is displayed on the screen, customer have to enter the order in the form 9tem=Code 7 Nuantity. 9n one order, multiple items may be there. eg. 1,,1,: 1,,:,+ 1,,+,1 2his order means that, : plates of 9dli=sambar, + plates of uttappa 7 1 plate of Fada=/av etc. +. Cancel the order After ordering food, if customer want to cancel the order, he"she have to choose this option. henever customer selects this option, already placed order should be displayed. Customer can cancel the order partially!i.e. number of plates can be increased or decreased of certain item# or completely!i.e. cancellation of a complete item#. 3. Generate Eill 9t should ask the name of customer. 2hen the bill may be generated in following form% Goodluck restaurant Q.0.(oad, /une 'ame of customer % Abhay /aran-ape ======================================================================================================== 9tem Code 9tem 'ame (ate Nty Amount 1,,1 9dli=4ambar 1+.,, : :I.,, 1,,+ Fada=/av ;.,, 1 ;.,, . . . . . . . . . . . . . . . . . . . . ======================================================================================================== 2otal Amount % ;:;.,, ========================================================================================================
c# char Sstrcombine!char S,char S# 2his function will concatenates two strings and returns the resultant string. d# e# rite a function to add digits of given number and return the result. int add*igits!int# rite one file 5myclient.c6 to make use of all above functions.
b. /rovide facility in menuMdriven data entry for /ersonD*et 2he menu options should be as follows% 0ain 0enu <<<<<<<< 1. Add +. *isplay 3. &$it 8or each option in above menu, write separate function to perform the desired operation as Add! #, *isplay!#, &$it!# Another user defined function is Check42*!#. *efine all these functions in a file .directory.h1. 2he main menu should be kept in main!# function in a ..c1 file. 8unctionality with all the options should be as follows% Add! # % 2his option should allow the user to take details !'ame, 9*,4tate,42*DCode,LocalD/hD'o# from user . 2his function should be e$ecuted as long as the user wants to add item. Eefore adding data into file the 42* Code must be checked
for validation by calling check42*!#.Aser should be asked to enter a proper value for the 42* code again 7 again unless and until the desired value is entered. Check42*!# % 2his function will call from Add function by passing 42*C?*& of a person as a pointer and it checks the starting character of 42*Code for 5,6 or not , and also checks the length of 42*Code passed through pointer lies between 3 and ; or not. *isplay! #% 2his option will display the details on the basis of person 9* in the following format% 'ame. Amit 4en &$it!#% 2his option will terminate the program. 9* +3: Address Jolkata 4tate E 42* /honeD'o !,33# 3:;CHC;C
C. (etrieve All 4tudent *etails from te$t file H. &$it 8or each option in above menu, write separate function to perform the desired operation as Add4tudent! #, Apdate4tudent! #, *elete4tudent! #, Fiew4tudent! #, (etrieve4tudent*etails!#, CalcDGrade!#, &$it! # . Calculate grade as follows 0arks Grade L<I, A *ivision L<C, E *ivision L<:, C *ivision K:, 8ail All these functions should be written in the header file 5functionlib.h6. 0ain application code should be written in file 5student0anagement.c6 file which makes use of 5student.h6 and 5functionlib.h6 files in it. 8unctionality with all the options should be as follows % Add 4tudent%= 2his option should allow the user to take 4tudent details from keyboard and add that to the file .4tudent.dat1. Falidations= 0arks should between , to 1,,. Generate 5rollDno6 automatically. Apdate 4tudent %= 2his option should allow the user to get rollDno as an input, then display that student details. Get the new details and update the record in the file .4tudent.dat1. *elete 4tudent%= 9t will ask for 5rollDno6 to be deleted. 9f rollDno does not e$ist in the file .4tudent.dat1, proper message should be given. Fiew 4tudent *etails%= Aser will input the roll number and option will display the record in file. (etrieve 4tudent *etails from te$t file%= 2his option reads data from file and display it in the following format,
Jnowledge Academy <<<<<<<<<<<<<<< 4tudent 0aster (ecords =============================== 4tudent 1. +. 3. &$it %= ill allow the user to e$it from an application. 4tudent 'ame abc $yR pqr 0arks I, C, :, Grade A E C
in is knows life limitation no not on taking thankfulness that we which 4uppose your program name is spell and you e$ecute it as below spe i!e8t:t dict8t:t output: 1 e$plortion + confinment, limiation 3 taing, 1ote: ;our program can sa!e y ma2e t6e !o o"ing assumptions t6e te:t !i e does not 6ave any punctuation c6aracters8 'ser "i a "ays invo2e t6e program by passing t"o !i e names on t6e command ine8 <ot6 t6e !i es "i e:ist in t6e current directory8