本文整理汇总了C++中prompt函数的典型用法代码示例。如果您正苦于以下问题:C++ prompt函数的具体用法?C++ prompt怎么用?C++ prompt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prompt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rectangles
void rectangles(double n)
{
double a = 0;
double b = 5000;
double i = a;
double h = (b - a) / 10000;
double result = 0;
while (i < b)
{
result = result + produit(n, (a + i * h));
i = i + 1;
}
result = result * h;
prompt(result, result - (M_PI / 2), n, 1);
}
开发者ID:1475963,项目名称:110borwein,代码行数:16,代码来源:borwein.c
示例2: minishell2
void minishell2(char **env)
{
char *bufpath[2];
char **tab;
char **cmd;
while (42)
{
bufpath[0] = prompt();
check_exit(bufpath[0]);
bufpath[1] = get_path(env);
tab = my_str_to_wordtab(bufpath[1]);
cmd = my_str_to_wordtab2(bufpath[0]);
process(bufpath, tab, cmd, env);
}
}
开发者ID:salldame,项目名称:bouche-qd,代码行数:16,代码来源:minishell2.c
示例3: signalhandling
//Function for handling signals
void signalhandling(int signum)
{
if(signum==20)
kill(pp,20);
if(signum==2 || signum ==3)
{
fflush(stdout);
printf("\n");
prompt();
fflush(stdout);
signal(SIGINT, signalhandling);
signal(SIGQUIT, signalhandling);
signal(SIGTSTP,signalhandling);
}
return;
}
开发者ID:ankitkotak93,项目名称:C-Terminal,代码行数:17,代码来源:201202102_Assignment3B.c
示例4: shell
void *
shell(void *arg)
{
int c;
int rc=1;
int menu=1;
while (1) {
if ((c=prompt(menu))!=0) rc=docmd(c);
if (rc<0) break;
if (rc==1) menu=1; else menu=0;
}
fprintf(stderr, "terminating\n");
fflush(stdout);
return NULL;
}
开发者ID:mely91,项目名称:FloppyDisk,代码行数:16,代码来源:server.c
示例5: trapezes
void trapezes(double n)
{
double a = 0;
double b = 5000;
double i = 1;
double h = (b - a) / 10000;
double result = 0;
while (i < b)
{
result = result + produit(n, (a + i * h));
i = i + 1;
}
result = ((result * 2) + produit(n, a) + produit(n, b)) * ((b - a) / 20000);
prompt(result, result - (M_PI / 2), n, 2);
}
开发者ID:1475963,项目名称:110borwein,代码行数:16,代码来源:borwein.c
示例6: sgetch
int
sgetch(const char *p, struct ship *ship, char flag)
{
int c;
prompt(p, ship);
blockalarm();
wrefresh(scroll_w);
unblockalarm();
while ((c = wgetch(scroll_w)) == EOF)
;
if (flag && c >= ' ' && c < 0x7f)
waddch(scroll_w, c);
endprompt(flag);
return c;
}
开发者ID:mihaicarabas,项目名称:dragonfly,代码行数:16,代码来源:pl_7.c
示例7: main
int main(int argc, char** argv) {
setup_error_handling();
if (argc > 1) {
int* script_argc = (int*)malloc(sizeof(int));
char** script_and_args = parseopts(argc, argv, script_argc);
if (*(script_argc)) {
return script(*(script_argc), script_and_args);
}
return 0;
} else {
print_version_info(argv[0]);
return prompt();
}
}
开发者ID:geekofhearts,项目名称:lang,代码行数:16,代码来源:lang.c
示例8: prompt
/**
* Method handling the downgrade interface for the installations
*/
void CLIStadiumView::showDowngradeInstallation()
{
size_t choice;
cout << "Enter the number of the installation you want to downgrade" << endl;
prompt();
cin >> choice;
if (choice < user().installations.size())
{
downgradeInstallation(choice);
_wait = true;
}
else
{
cout << "The number you entered is wrong" << endl;
}
}
开发者ID:dilo00o,项目名称:ProQuidditchManager,代码行数:19,代码来源:CLIStadiumView.cpp
示例9: PipUIContext
void nsNSSCertificateDB::DisplayCertificateAlert(nsIInterfaceRequestor *ctx,
const char *stringID,
nsIX509Cert *certToShow)
{
nsPSMUITracker tracker;
if (!tracker.isUIForbidden()) {
nsCOMPtr<nsIInterfaceRequestor> my_cxt = ctx;
if (!my_cxt)
my_cxt = new PipUIContext();
// This shall be replaced by embedding ovverridable prompts
// as discussed in bug 310446, and should make use of certToShow.
nsresult rv;
nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID, &rv));
if (NS_SUCCEEDED(rv)) {
nsAutoString tmpMessage;
nssComponent->GetPIPNSSBundleString(stringID, tmpMessage);
// The interface requestor object may not be safe, so proxy the call to get
// the nsIPrompt.
nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;
NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
NS_GET_IID(nsIInterfaceRequestor),
my_cxt,
NS_PROXY_SYNC,
getter_AddRefs(proxiedCallbacks));
nsCOMPtr<nsIPrompt> prompt (do_GetInterface(proxiedCallbacks));
if (!prompt)
return;
// Finally, get a proxy for the nsIPrompt
nsCOMPtr<nsIPrompt> proxyPrompt;
NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
NS_GET_IID(nsIPrompt),
prompt,
NS_PROXY_SYNC,
getter_AddRefs(proxyPrompt));
proxyPrompt->Alert(nsnull, tmpMessage.get());
}
}
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:47,代码来源:nsNSSCertificateDB.cpp
示例10: consh
/*
* Fork a program with:
* 0 <-> remote tty in
* 1 <-> remote tty out
* 2 <-> local tty stderr out
*/
void
consh(int c)
{
char buf[256];
int cpid, status, p;
sig_handler_t ointr, oquit;
time_t start;
(void) putchar(c);
if (prompt("Local command? ", buf, sizeof (buf)))
return;
(void) kill(pid, SIGIOT); /* put TIPOUT into a wait state */
(void) read(repdes[0], (char *)&ccc, 1);
ointr = signal(SIGINT, SIG_IGN);
oquit = signal(SIGQUIT, SIG_IGN);
unraw();
/*
* Set up file descriptors in the child and
* let it go...
*/
if ((cpid = fork()) < 0)
(void) printf("can't fork!\r\n");
else if (cpid) {
start = time(0);
while ((p = wait(&status)) > 0 && p != cpid)
;
raw();
(void) signal(SIGINT, ointr);
(void) signal(SIGQUIT, oquit);
} else {
int i;
userperm();
(void) dup2(FD, 0);
(void) dup2(0, 1);
for (i = 3; i < 20; i++)
(void) close(i);
(void) signal(SIGINT, SIG_DFL);
(void) signal(SIGQUIT, SIG_DFL);
execute(buf);
(void) printf("can't find `%s'\r\n", buf);
exit(0);
}
if (boolean(value(VERBOSE)))
prtime("\r\naway for ", time(0)-start);
(void) write(fildes[1], (char *)&ccc, 1);
}
开发者ID:AlfredArouna,项目名称:illumos-gate,代码行数:53,代码来源:cmds.c
示例11: loop
void loop()
{
while (Serial.available()) // If serial data is available on the port
{
inByte = (char)Serial.read(); // Read a byte
if (echo) Serial.print(inByte); // If the scho is on then print it back to the host
if (inByte == '\r') // Once a /r is recvd check to see if it's a good command
{
if (echo) Serial.println(); // Dummy empty line
if (inData == "up") lift_arm();
else if (inData == "downs") down_seek(50, 0); // Lower arm until it finds bottom
else if (inData == "down") down(50, ARM_DN_POSITION); // Blindly lower arm
else if (inData == "pump on") pump(ON); // Start pump
else if (inData == "pump off") pump(OFF); // Stop pump
else if (inData == "vent") pump_release(); // Stop pump and vent the vacuum
else if (inData == "left") baseLeft(16); // Move base to the left
else if (inData == "center") findCenter(); // Move base to the right
else if (inData == "right") baseRight(BASE_CENTER_POSITION);// Move base to the right
else if (inData == "stop") baseStop(); // Stop base
else if (inData == "home") left_home(); // Mode base left until it finds home
else if (inData == "status") stats(); // Show current status
else if (inData == "stats") stats(); // Show current stats
else if (inData == "get disk") get_disk(); // Macro to get disk and lift to top
else if (inData == "load disk") load_disk(); // Macro to get disk and move to center
else if (inData == "unload disk") unload_disk(); // Macro to get disk and move to center
else if (inData == "place disk") place_disk(); // Macro to lower disk into tray
else if (inData == "debug on") debug_mode = true; // turn on debug mode, prints encoder values
else if (inData == "debug off") debug_mode = false; // Turn off debug mode
else if (inData == "echo on") echo = true; // Turn on echo mode
else if (inData == "echo off") echo = false; // Turn off echo mode
else // The string wasn't recognized so it was a bad command
{
Serial.print("Error, Unknown Command: "); // Show the error
Serial.println(inData); // Echo the command
}
inData = ""; // Clear the buffer (string)
if (echo) prompt(); // reprint the prompt
}
else inData += inByte; // If it's not a /r then keep adding to the string (buffer)
}
}
开发者ID:jes1510,项目名称:RoboBurner,代码行数:46,代码来源:Burner.cpp
示例12: main
int main(int argc, char **argv)
{
int pid;
// size_t len;
if (argc != 3)
{
ft_putendl("Invalid number of argument.");
exit(0);
}
signal(SIGUSR2, handler);
pid = ft_atoi(argv[1]);
// len = ft_strlen(argv[2]);
// ft_send_len(pid, len);
prompt(pid, argv[2]);
return (0);
}
开发者ID:iTzDyms,项目名称:Mini-Talk,代码行数:17,代码来源:client.c
示例13: init_values
int init_values(int *history_pl, int *reverse_case,
char **str, char **cmd)
{
*history_pl = 0;
*reverse_case = 0;
if (((*str) = malloc(sizeof(**str) * 5)) == NULL ||
((*cmd) = malloc(sizeof(**cmd) * 2)) == NULL)
{
if ((*str) != NULL)
free(*str);
return (-1);
}
(*str) = my_memset((*str), 0, 5);
(*cmd) = my_memset((*cmd), 0, 2);
prompt(TRUE);
return (0);
}
开发者ID:Colliotv,项目名称:42.sh,代码行数:17,代码来源:edit_line.c
示例14: waitforexit
void waitforexit(void)
{
printf("Press A to get back to main menu.\n");
struct controller_data_s controller;
while(1)
{
struct controller_data_s button;
if (get_controller_data(&button, 0))
{
if((button.a)&&(!controller.a))
prompt(MAIN_MENU);
controller=button;
}
usb_do_poll();
}
}
开发者ID:IUNIXI,项目名称:LxNAND,代码行数:17,代码来源:main.c
示例15: shell
int
shell(int argc, char ** argv)
{
/* Buffer de almacenamiento de caracteres */
char in_buffer[MAX_CHARS];
set_screen();
clear_screen();
welcome();
while(1) {
prompt();
getline(in_buffer,MAX_CHARS);
// proceso el comando almacenado en in_buffer
bash(in_buffer);
}
return 1 ;
}
开发者ID:ddome,项目名称:so2,代码行数:17,代码来源:shell.c
示例16: main
////////////////////////////// The main land //////////////////////////////
int main(int argc, char* argv[]){
int flags[6] = {0,0,0,0,0,0};
//flags = [t | n | p | v | c | q ]
int num_thread=0, num_astr=0 ;
obj *astr;
thread_info t_info;
int t = 1; // t is a preiod of time measure in a second
int max_t=1000;
thread_argv *targv;
pthread_t *t_id;
argv_handler(argc, argv, flags);
prompt(&num_thread, &num_astr, &t_info, &astr, flags, &max_t);
ini_astr(num_astr, astr);
targv = malloc(sizeof(thread_argv)*num_thread);
for(int a = 0; a < num_thread; a++){
targv[a].num_astr = num_astr;
targv[a].astr = astr;
targv[a].t_info = malloc(sizeof(thread_info));
targv[a].t = t;
}
//FIXME: while time steps goes here
for(int time = 0; time < max_t; time++){
pthread_barrier_init(&barrier, NULL, num_thread);
t_id = hive(num_thread, targv );
for(int k=0; k<num_thread; ++k){
if(pthread_join(t_id[k],NULL)!=0){
perror("The Hive Cluster is under attcked");
exit(EXIT_FAILURE);
}
}
pthread_barrier_destroy(&barrier);
if(time == 0 || time == max_t-1){
if(flags[3]==1)
print_all(num_astr, astr, time);
if(flags[4]==1)
print_c(num_astr, astr, time);
if(flags[5]==1)
print_q(num_thread, targv,time);
}
}
return 0;
}
开发者ID:Lars139,项目名称:Archive,代码行数:47,代码来源:main_works.c
示例17: main
int main(){
initShell();
initProcessList();
while(1){
prompt(); //substituir por variavel - para mostra o diretorio que esta
newProcess = (Process_Object *)malloc(sizeof(Process_Object));
parser();
runProcess(newProcess);
//resetAttributes();
}
}
开发者ID:viniciusyule,项目名称:shell_soii,代码行数:17,代码来源:main.c
示例18: _servosCenter
void _servosCenter(SERVO_LIST* const servos, uint8_t numServos, UART* uart){
rprintfInit(uart->writer);
list(servos,numServos);
help();
prompt();
while(1){
char c = getCh(uart);
switch(c){
case 'L':
list(servos,numServos);
prompt();
break;
case '+':
update(servos,1);
break;
case '*':
update(servos,10);
break;
case '-':
update(servos,-1);
break;
case '/':
update(servos,-10);
break;
case 'N':
current = (current+1) % numServos;
prompt();
break;
case 'P':
current = (current==0) ? numServos-1 : current-1;
prompt();
break;
case 'C':
setRanging(FALSE, servos,numServos);
prompt();
break;
case 'R':
setRanging(TRUE, servos,numServos);
prompt();
break;
default:
help();
prompt();
break;
}
}
}
开发者ID:kenzanin,项目名称:webbotavrclib-1x,代码行数:48,代码来源:servosCenter.c
示例19: shell
void *
shell(void *arg)
{
Client *C = arg;
char input[INPUTSIZE];
int rc;
int menu=1;
//the following is done in order to change the prompt for the user to X or O
while (1) {
// Clear input each time
bzero(&input, INPUTSIZE);
prompt(menu, input);
if (strlen(input)>0) {
rc=docmd(C, input);
menu = 1;
}
if (rc<0) {
killConnection(C->ph);
break;
}
if (rc==1)
{
menu=1;
// Proto_Game_State *gs = proto_client_game_state(C->ph);
}
if (((Proto_Client *) C->ph)->game.status == IN_PROGRESS && DISPLAYUI == 1)
{
// launchUI(C);
return NULL;
}
else menu=1;
}
if (PROTO_PRINT_DUMPS==1) fprintf(stderr, "terminating\n");
fflush(stdout);
return NULL;
}
开发者ID:bxscikai,项目名称:hackers,代码行数:45,代码来源:client.c
示例20: sp_process
void sp_process()
{
char c;
while((c = serialRead()) != -1)
{
if((char_counter > 0) && ((c == '\n') || (c == '\r'))) { // Line is complete. Then execute!
line[char_counter] = 0; // treminate string
status_message(gc_execute_line(line));
char_counter = 0; // reset line buffer index
prompt();
} else if (c <= ' ') { // Throw away whitepace and control characters
} else if (c >= 'a' && c <= 'z') { // Upcase lowercase
line[char_counter++] = c-'a'+'A';
} else {
line[char_counter++] = c;
}
}
}
开发者ID:simen,项目名称:shuttleboom,代码行数:18,代码来源:serial_protocol.c
注:本文中的prompt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论