The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Project 1, COP 3514, summer 09
Write a C program that asks the user to enter a positive integer (the integer could be of any number of digits in the range of the integer type) and replace each digit by the sum of that digit plus 6 modulus 10. The program then should swap the first digit with the last digit before it displays the output. Must follow the instructions in the attached doc. Ignore the first part of the project(barcode2.c).
Project 6, Program Design 1. (30 points) Note: This program will be graded based on whether the required functionality were implemented correctly instead of whether it produces the correct output, for the functionality part (80% of the grade). Modifybarcode.c(atached, ProjecT 4, #2), The edge deTec±on func±on using poinTer ariThme±c. ²he func±on proToType shouldbe The following. Name your programbarcode2.c.void edge(int n, int *a1, int *a2);The function should use pointer arithmetic – not subscripting – to visit array elements. In other words, eliminate the loop index variables and all use of the [] operator in the function. 2. (70 points) Write a C program that asks the user to enter a positive integer (the integer could be of any number of digits in the rangeof the integer type) and replace each digit bythe sum of that digit plus 6 modulus 10. The program then should swap the first digitwith the last digit before it displays the output. A sample input/output:Enter the number of digits of the number: 5Enter the number: 92828Output: 48485.1) Name your programreplace2.c..2) ²he user will enTer The ToTal number of digiTs before enTering The number.3)You can use formaT speciFer “%1d” in scanf To read in a single digiT inTo a variable (or an array elemenT). ³or example, for inpuT101011, scanf(“%1d”, %num) will read in 1 To num.4) As parT of The solu±on, wriTe and call The func±onreplace()wiTh The following proToType. ²hereplace()func±onassumes ThaT The digiTs are sTored in The arrayaand compuTes The replaced digiTs and sTore Them in The arrayb. c represenTs Thesize of The arrays.void replace(int *a, int *b, int n);.The replace() function should use pointer arithmetic – not subscripting – to visit array elements. In other words, eliminate the loop index variables and all use of the [] operator in the function. .5) As parT of The solu±on, wriTe and call The func±onswap()wiTh The following proToType.void swap(int *p, int*q);.When passed The addresses of Two variables, Theswap()func±on should exchange The values of The variables:swap(&i, &j); /*exchange values of i and j */
Attachments: