Using C programming
Using the supplied example code as a starting point, add 3 more conversions using strtod(). Make sure you change the output conversion for type double. Use the same input strings and base codes as the strtol() function example but notice how the numbers are now represented. Manipulate the width and precision as needed for a good presentation.
Supplied code:
#include <stdio.h>
#include <string.h>
int main(void)
{
long num;
char* ptr;
num = strtol("12345 Decimal Constant: ", &ptr, 0);
printf("%s \t%ld\n", ptr, num);
num = strtol("11001 Binary Constant: ", &ptr, 2);
printf("%s \t%ld\n", ptr, num);
num = strtol("13572 123 Octal Constant: ", &ptr, 8);
printf("%s \t%ld\n", ptr, num);
//put your conversions here
return 0;
}//end main
#include <stdio.h>
#include <string.h>
int main(void)
{
long num;
double d;
char* ptr;
num = strtol("12345 Decimal Constant: ", &ptr, 0);
printf("%s \t%ld\n", ptr, num);
num = strtol("11001 Binary Constant: ", &ptr, 2);
printf("%s \t%ld\n", ptr, num);
num = strtol("13572 123 Octal Constant: ", &ptr, 8);
printf("%s \t%ld\n", ptr, num);
//put your conversions here
d = strtod("12345.0 Decimal Constant: ", &ptr, 0);
printf("%s \t%lf\n", ptr, d);
d = strtod("11001.0 Binary Constant: ", &ptr, 2);
printf("%s \t%lf\n", ptr, d);
d = strtod("13572 123 Octal Constant: ", &ptr, 8);
printf("%s \t%lf\n", ptr, d);
return 0;
}//end main


Using C programming Using the supplied example code as a starting point, add 3 more conversions...
Create a functional ATM using the code base given in the example. You must use the routines provided in the code base example. Failure to follow the directions will result in an 'F' the example is down below! /* * @desc: Simple ATM machine * @duedate: 23-April-2019 * * * */ #include <stdio.h> #include <time.h> #include <stdlib.h> #include <string.h> char menu(); char transaction_menu(); /* Verifies the Pin Entered match the PIN on record */ int validatePin(int); /* Verifies the funds...
Solve using C programming
3. lf you are given this code. #include <stdio.h> int main() int var1, var2; int sum; printf("Enter number 1:\n "); scanf("%d",&var1); printf("Enter number 2:In ); scanf("%d",&var2); sum-var1+var2; printf ("Vnsum of two entered numbers : %d", //printf ("Output: %d", res); sum); return e; Modify this code by creating a function called "addition". Make the arguments of the functions numberl and number 2. Add the two values in the function. Return a value called "result". Print "result" in...
I need help fixing this code in C. It keeps giving me an error saying error: ‘O_RDWD’ undeclared (first use in this function) if ((fd = open(fifo, O_RDWD)) < 0) note: each undeclared identifier is reported only once for each function it appears in. Please fix so it compiles properly. //************************************************************************************************************************************************** #include <fcntl.h> #include <stdio.h> #include <errno.h> #include<stdlib.h> #include <string.h> #include<unistd.h> #include <sys/stat.h> #include <sys/types.h> #define MSGSIZE 63 char *fifo = "fifo"; int main(int argc, char **argv){ int fd;...
Hello, I have my piece of C programming code and I have a pointer initialized to point to my array and I need help to display the contents of my array using a while loop or do-while loop. The stop condition should be when the pointer reaches '\0'. The code is below: #include <stdio.h> int main () { char array[80]; printf("Enter a string: "); scanf("%[^\n]", &array); printf("%s\n", array); char * p; p = array; }
Explain the code and analyze the performance of algorithm #include<stdio.h> #include<string.h> #define NUM 100 #define maxint 10000 void dijkstra(int n,int v,int dist[],int prev[],int c[][NUM]) { int i,j; bool s[NUM]; for(i=1; i<=n; i++) { dist[i] = c[v][i]; s[i] = false; if (dist[i]>maxint) prev[i] = 0; else prev[i] = v; } dist[v] = 0; s[v] = true; for(i=1; i<n; i++) { int tmp = maxint; int u = v; for(j=1; j<=n; j++) if(!(s[j]) && (dist[j]<tmp)) { u = j; tmp = dist[j]; ...
c program Your teacher want to find out who is the most hardworking student in class! They want to input the names according to the order they fell asleep, then print their names in the reverse order. Although you can create an array large enough to store all names, your teacher don’t want to waste our precious memory! The first line of the input is an integer x, which indicate the number of students in class. Then there are x...
I am trying to write C programming code and output will be as
below
but I donno how to get the result analysis part.
help me to add the 2nd part with my code:
here is my code below:
#include <stdio.h>
#define MAX 100
struct studentMarkVariable{
int id;
float marks;
};
void getData(struct studentMarkVariable arrs[]);
void show(struct studentMarkVariable arrs[]);
int main()
{
printf ("####### Marks Analyzer V3.0 ####### \n");
struct studentMarkVariable
arrs[MAX];
getData(arrs);
show(arrs);
return 0;
}...
Using C programming (Microsoft Visual Studio)
This is the code I have
#include "pch.h"
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include<dos.h>
#include <iostream>
int id_arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
};
int pid_arr[] = { 0, 0, 0, 1, 13, 1, 2, 2, 5, 5, 5, 10, 4 };
char title_arr[][100] = {
"Books & Audibles",
"Electronics",
"Food",
"Books",
"Science & Mathematics books",
"Fictions",
"Phones",
"Appliances",
"Astronomy",
"Physics",...
The following code is a C Program that is written for encrypting
and decrypting a string. provide a full explanation of the working
flow of the program.
#include <stdio.h> int main() { int i, x; char str[100]; printf("\n Please enter a valid string: \t"); gets (str); printf ("\n Please choose one of the following options: \n"); printf ("1 = Encrypt the given string. \n"); printf("2 = Decrypt the entered string. \n"); scanf("%d",&x); // using switch case statements switch (x) {...
Using C, I need help debugging this program. I have a few error messages that I'm not sure how to fix. Here is the code I have: /* * C Program to Print a Linked List in Reverse Order */ #include <stdio.h> #include <stdlib.h> struct node { int num; struct node *next; }; int main() { struct node *p = NULL; struct node_occur *head = NULL; int n; printf("Enter data into the list\n"); create(&p); printf("Displaying the nodes in the list:\n");...