Write a code in C language to do following: 1. display pin input by user in **** form instead of numbers by using ncurses 2. verify the pin by comparing with already stored 2 pins in a text file 3. change text color as per user choice
WINDOWS BASED
//code for the problem
#include<stdio.h>
#include<conio.h>
#include<stdbool.h>
#include<windows.h>
HANDLE console_handle; //we will create a handle to our window
int gettextattribute(){
CONSOLE_SCREEN_BUFFER_INFO buffer;
//object of console screen
buffer
GetConsoleScreenBufferInfo(console_handle,&buffer);
return buffer.wAttributes;
}
void textcolor(int color){
SetConsoleTextAttribute(console_handle,
(gettextattribute() & 0xf0) |color);
//this
sets the console texr arrtribut to color
}
void main(){
char userid[8];
//to make it easiar to
understand i took a 8 digit user id
printf("Enter your user id\n");
scanf("%s",userid); //to defferentiate between
different users
char pass[30];
int i=0,j;
do{
pass[i]=getch();
//here getch() takes input till it takes
//\r as input, which
indicates that user hit enter.
if(pass[i]!='\r'){
printf("*");
//we will print *
corresponding to every input
}
i++;
}while(pass[i-1]!='\r');
pass[i-1]='\0';
FILE *fl= fopen("abc.txt","r");
//open the file
char data[50];
bool flag;
while(fgets(data,50,fl)!=NULL){
//reads file line by
line
//printf("%s",data);
flag=false;
for(j=0;j<8;j++){
if(data[i]!=userid[i]){
flag=true;
//user id
mismatch
break;
}
}
if(!flag){
for(j=0;j<i-1;j++){
if(data[9+j]!=pass[j]){
flag=true;
//password
mismatch
printf("\nincorrect
password\n %d\n",j,i);
break;
}
}
}
if(!flag){
textcolor(5);
//to set text color
//now consoles do not support
inbuilt textcolor feature, so we have to create it manually
_cprintf("\nCorrect Password\r\n");
break;
}
}
}
//corresponding abc.txt file
11710548 aniket
11710549 nikita
Write a code in C language to do following: 1. display pin input by user in...
Write a code in C language to do following: 1. display pin input by user in **** form instead of numbers by using ncurses 2. verify the pin by comparing with already stored 2 pins in a text file 3. change text color as per user choice WINDOWS BASED
Write an interactive C++ program that asks a user to input the color code of a resistor and determines its value and tolerance Tell the user how to input the color rings “Instructions” Tell the user to input the colors one after the other After the program receives the information it will display the resistance and tolerance Output an error message if the user enters an invalid color code (no garbage values should be displayed), and ask for another input...
In java, write a program that gets 10 integer numbers from the user using user input, and then calculates and display the sum of the numbers that have been read. Program Requirements: Write the program in three versions with three loops. Put all three loops in the main method of your source code. The program must be in one file. version1: use a while loop. version2: use a do-while loop. version 3: use a for loop. For each version, use a loop to...
Write a C program as follows: Single source code file Requests the user to input two integer numbers Requests the user to make a choice between 0 (add), 1 (subtract), or 2 (multiply) Declares three separate functions Uses a pointer to these three functions to perform the requested action Outputs the result to the screen Submit your program source code file to this assignment. Sample Output Enter first integer number: 15 Enter second integer number: 10 Enter Choice: 0 for...
Write a program in Visual C# that generates 1000 random numbers with a user provided seed and upper limit on the random numbers generated. The numbers should be stored in a text file, each appearing on a newline, using the Windows Save File dialog. Each number should be separated by a newline.
C++ (1) Write a program to prompt the user for an input and output file name. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs. For example, (user input shown in caps in first line, and in second case, trying to write to a folder which you may not have write authority in) Enter input filename: DOESNOTEXIST.T Error opening input file: DOESNOTEXIST.T...
please answer correctly and follow the code structure given [JavaFX/ Exception handing and text I/O] 1. Write a program for the following. NOTE that some of these steps are not dependent on each other. Using methods is mandatory. Make sure to use methods where it makes sense. a. Ask the user for a series of integers entered from the keyboard. Use a sentinel value such as 999 to end the input process. If the entered values are not integers, throw...
Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type. Have the user specify the number of rows and the number of columns for the two dimensional array. Have the user enter the values for each row and column element in...
Please write this in C.
Write this code in Visual Studio and upload your Source.cpp file for checking (1) Write a program to prompt the user for an output file name and 2 input file names. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs opening any of the 3 For example, (user input shown in caps in first line) Enter first...
Topics: list, file input/output (Python) You will write a program that allows the user to read grade data from a text file, view computed statistical values based on the data, and to save the computed statistics to a text file. You will use a list to store the data read in, and for computing the statistics. You must use functions. The data: The user has the option to load a data file. The data consists of integer values representing student...