please help me write function definition of this code ..thanks
/* Test change_case function. */
#include "nodep.h" //suppress deprecation
warnings
#include <stdio.h> //printf(), scanf()
#include <conio.h> //getch()
#define _CRT_SECURE_NO_DEPRECATE 1
#define _CRT_NONSTDC_NO_DEPRECATE 1
#define ESC 27
#define LETTER_a 97
#define LETTER_z 122
#define LETTER_A 65
#define LETTER_Z 90
//function prototype:
char change_case(char cIn);
int main(void)
{
char cInput, cOutput;
printf("Test change_case
function...\n\n");
printf("(Press ESC to exit, any other key to keep
testing)\n");
do
{
printf("\n\nEnter letter: ");
cInput = _getche();
cOutput = change_case(cInput);
if(cOutput >= LETTER_A && cOutput
<= LETTER_Z || cOutput >= LETTER_a && cOutput <=
LETTER_z)
printf("\nLetter with case
changed = %c\n", cOutput); //endif
}
while(cInput != ESC);
//enddowhile
return 0;
} //end program
//----------------------------------------------------------------------
//function definition:
char change_case(char cIn)
{
return change_case;
}
// change_case function implementation
char change_case(char cIn)
{
char change_case;
if(cIn >= LETTER_A && cIn <= LETTER_Z ){
change_case = (char)(97 + (int)(cIn - 'A')); // as char a = 97 in ascii
}
if(cIn >= LETTER_a && cIn <= LETTER_z){
change_case = (char)(65 + (int)(cIn - 'a')); // as char A = 65 in ascii
}
return change_case;
}
please help me write function definition of this code ..thanks /* Test change_case function. */ #include...
Code in C++: Please help me fix the error in function: void write_account(); //function to write record in binary file (NOTE: I able to store data to a txt file but however the data get error when I try to add on data the second time) void display_all(); //function to display all account details (NOTE: This function is to display all the info that save account.txt which is ID, Name, and Type) void modify_account(int); //function to modify record of file...
Hi, this program is in C. Can you a pass by pointer in this program. Thanks. #include //function declaration/prototype here int main(int argc, char * argv[]) { int num1, num2; printf("Please enter two integers (separated by ,):\n"); scanf("%d,%d", &num1, &num2); //enter two integers separated by a comma (,) printf("num1 stores: %d\n", num1); printf("num2 stores: %d\n", num2); /*make a function call to make sure the followings are true after we call the function (1) variable num1 stores the larger value after...
In C please Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). Original maino: int main(void) { double milesPerHour, double minutes Traveled; double hours Traveled; double miles Traveled; scanf("%f", &milesPerHour); scanf("%lf", &minutes Traveled); hours Traveled = minutes Traveled / 60.0; miles Traveled = hours Traveled * milesPerHour; printf("Miles: %1f\n", miles Traveled); return 0; 1 #include <stdio.h> 3/* Your solution goes here */ 1 test passed 4 All tests passed...
C program-- the output is not right please help me to correct it. #include <stdio.h> int main() { int arr[100]; int i,j,n,p,value,temp; printf("Enter the number of elements in the array: \n "); scanf("%d",&n); printf("Enter %d elements in the array: \n",n); for(i=0;i<n;i++) { printf("\nelement %d: ",i); scanf("\n%d",&arr[i]); } printf("\nEnter the value to be inserted: \n "); scanf("\n%d",&value); printf("The exist array is: \n"); for(i=0;i<n;i++) { printf("%d",arr[i]); } p=i; for(i=0;i<n;i++) if(value<arr[i] ) { p = i; break; } arr[p]=value; printf("\n"); for (i =...
Identify and list all the User defined Functions to be used in the system #include <stdio.h> ///for input output functions like printf, scanf #include <stdlib.h> #include <conio.h> #include <windows.h> ///for windows related functions (not important) #include <string.h> ///string operations /** List of Global Variable */ COORD coord = {0,0}; /// top-left corner of window /** function : gotoxy @param input: x and y coordinates @param output: moves the cursor in specified position of console */ void gotoxy(int x,int y) {...
C program help 2. For the following code: #include "stdafx.h" struct State char out struct State *next[2]; b; typedef struct State States; #define STe &FSM[8] #define ST1 &FSM[1] #define ST2 &FSM[2] States FSM[3] { {"L', {STe, ST1)), {'1', {STe, sT2)), {ST1, = {.2', ST2))); int main() States "ptr &FSM[e]; int in; while (1) printf("cIn", ptr->out); printf("Enter a e or 1 to operate this machine: "); scanf s("Xd", &in); ptr ptr->next[in]; return e; Draw the finite state machine diagram for this...
Write a function that can return the length of a string in C language. Please leave comments to explain the code and verify that it runs properly... Example: Input String: China The length of the string is 5. #include <stdio.h> int length(char * p) { /write your code here } main(){ int len; char str[20]; printf("Input string:"); scanf("%s", str); len = length(str); printf("The length of string is %d. ", len); getchar(); ...
Given the following source programs, write down the letter that correspond to the right answer #include <stdio.h> #ifndef MEMORY #include "myhead.h" #include <stdlib.h> myhead.h #include <string.h> int main() { #endif char *text= MEM(SIZE, char); #define SIZE 10 COPY_TEXT (text, MSG); #define MSG "CS262" newtext (text); #define MEM(size, type) SHOW (text); (type *) malloc(size * sizeof(type)) free (text); #define COPY_TEXT (dest, source) return 0; strcpy (dest, source) } text.c #define SHOW (x) printf("Output: %s\n", x) void newtext (char *text) { int...
Please answer problem #5 thank you str.c #include "str.h" #include <stdio.h> int str_len(char *s) { /* this is here so code compiles */ return 0; } /* array version */ /* concantenate t to the end of s; s must be big enough */ void str_cat(char s[], char t[]) { int i, j; i = j = 0; while (s[i] != '\0') /* find end of s */ i++; while ((s[i++] = t[j++]) != '\0') /* copy t */ ;...
Programming C....... function code is clear but compile is wrong .. I input 8 and compiled 2 0 1 1 2 3 5 8 13.. look first number 2 is wrong. The correct answer 8 is 0 1 1 2 3 5 8 13 21.. Need fix code to compile correctly.. Here code.c --------------------------------------------------------------------------------------------------------------------- #include <stdio.h> #include <math.h> int fibonacciIterative( int n ) { int fib[1000]; int i; fib[ 0 ] = 0; fib[ 1 ] = 1; for (...