i want to add a prompt at the start of my program which ask a user to enter its password wat will be its syntax it is confusing me alot i have written this code but its gving me a problem
int security(char *num)
{
char pass[10];
ifstream file("pass.txt", ios::in);
How to write a simple script to convert F to C. That was easy enough once I read about how C treats the math of 5/9 being less then 1 thus converts to 0. Fixed that issue and the code works great.
I find it a useful tool and would like to, way outside of the scope of the homework mind you, figure out a way to get the script to restart if a [Yy] answer is provided at the end of the script. All other responses result in return(0).
I only have limited knowledge in BASH scripting. In BASH i would have just placed the int main(void) {foo} into a single function then created a simple if/then test after the function is called.
Reading up on functions in C, they do not work in the same way I would like to treat them from BASH. understandable this is not BASH.
then i started looking into do/while loops. On an other forum someone pointed out the possibility of using fgets as part of the challenge response. Now when I try to compile the code im getting an odd result. for some reason the compiler seems to think that my character string(or is it an array) is an integer...
Code: /* 5. Write a program to convert a temperature in degrees Fahrenheit to degrees Celsius. *///########################################################## // Created by Raymond L. Brunkow // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 or version 3 of the // license, at your option. //
[Code] ....
//above is were the homework ends, below is what im trying to do now. /* Prompt for new input */ printf(" Would you like to enter a new temperature [Y]es or [N]o? "); fgets( BUFFER, sizeof(BUFFER), stdin ); } while ( sscanf( BUFFER, "%1s%*1s", ANS ) != 1 || strchr( "YyNn", *ANS ) == NULL ); return(0); }
This results in the following error:
Code: $ gcc -o hw_1_5.v2 hw_1_5.v2.c hw_1_5.v2.c: In function "main": hw_1_5.v2.c:52: warning: passing argument 1 of "fgets" makes pointer from integer without a cast There is no integer there to be passed.
My motive is to get random variable at every start of program. So it does not show same sequence when it run again and again
Code: int main(){ srand( time ( NULL ) ); cout<<rand(); }
When i run this program in code::block the following program is opening with error in new tab called TIME.H
Code: /* * time.h
* This file has no copyright assigned and is placed in the Public Domain. * This file is a part of the mingw-runtime package. * No warranty is given; refer to the file DISCLAIMER within the package. * * Date and time functions and types. * */
Right now I am trying to make an alarm clock type program that will start on login and will go off when a certain time is reached. I also want to set a password that will prevent system use until the correct password is entered into the program's input. What functions will I need and how are they used?
I want to know if there is a function or library that starts counting time when the program starts. Because I'm making a program that is dependent on time.
Pseudo code
time starts if ( seconds % 2 == 0 ) { counter++; }
I am looking to make a program for C++ that has a GUI other than command prompt. The program I am trying to create will ask certain questions and display the results at the end after all questions are asked and have 2 copies of the results one over the other that can be printed as a receipt. Basically I am wondering can I do this using C++. Also I want another GUI other than command prompt as well. Something close to what windows uses if possible.
I need to create a program that will prompt the user for an input, then it will save their input to a file and then it will prompt the user to input "Open" and then the file containing their first input, will open up and show their input.
I have a program which call only one time malloc at the start of the program. When running, I see with 'process-explorer.exe' that memory is growing in little steps. Is this normal? why?
I am developing a program that needs auto start at windows startup. For that I need to add Registry entries. Also the program needs to read some registry keys. What are the functions i need to do these.. Simply I need to
check if the startup key already exists add a new key if it doesn't exist read a key values
How can I send information and receive from external command prompt from my program??. I want to run an external command prompt, a code that's is not mine, to send information to this command prompt, then make my program hit enter at the command prompt and then receive back information from the command prompt.
I started writing in c because I want to control relays with the parallel port, or anything else. Doesn't really matter what I use I just need to know where to start. Trying to send and receive data from the outside world with c programming on a GNU/Linux os? If so any good some what up to date resources online?
I'm new to C programming and am quiet lost, create a program that takes a start and stop time and prints the passed, or show me where I can find the information needed?
Write a program to simulate a printer queue (priority queue or heap – Bentley article has code) where 3 printers are “fed” by this queue. Each print job has an unchanging priority and higher priority jobs go first (although once started, a job isn't stopped to let a higher one go). For each unit of time, there is a 26% probability that a job will be added to the queue and all jobs take 8 time units to complete. Print job priorities are between 5 and 100. The queue opens 20 time units prior to the start of printing for adding print “jobs”. A print “day” is 1000 time units. The output from your program is:
1) A list of jobs completed with their priorities for each printer
I am doing a homework assignment. I do not want the complete answer, just a hint. I have to load a file of names into an array, display the names, then sort the names alphabetically, display them again, then list how many names start with certain letters. I have everything done but how to display how many names start with a certain letter.
Here are the names:
Collins, Bill Smith, Bart Allen, Jim Griffin, Jim Stamey, Marty Rose, Geri ...........
I'm poking around with doing a few Haskell-like functions for linked-lists. Take, drop and so on.I've done the code below. The problem is that it mysteriously inserts a 0 at the start of the list.
I'm interested in learning how to write the software for audio synthesizers. a friend of mine started on the hardware side for them and, as i have no experience with this type of code.