小编Tho*_*ley的帖子

如何修改函数中的结构并返回main?

#include <stdio.h>
#include <stdlib.h>


struct time{int hours, mins, secs;};

int main(int argc, char *argv[])
{
struct time one;
struct time two; 

printf("\nplease enter the time in 24 hr format, \nenter the hours, return,\nenter minutes, return, enter seconds, and return.\n");

scanf("%d\n%d\n%d", &one.hours, &one.mins, &one.secs); 
int yn; 

yn = validateTime(one, yn); 
while(!yn){ 


      if (!yn){
         puts("Invalid input\nPlease try again"); 
         printf("\nplease enter the time in 24 hr format, \nenter the hours, return,\nenter minutes, return, enter seconds, and return.\n");
         scanf("%d\n%d\n%d", &one.hours, &one.mins, &one.secs);  
         yn = …
Run Code Online (Sandbox Code Playgroud)

c

3
推荐指数
3
解决办法
2万
查看次数

在程序中,在交换功能中迷路"\ 150"

#include <stdio.h>
#include <ctype.h> /*header for standard tolower function*/
#define STRING_LEN 500

char * changeCase(char *);
void stripspaces(char*, char*, char*);
int isinteger(char*);
int isHex(char*);
void strrev(char*);


int main(void)
{
    char line[STRING_LEN];
    char line1[STRING_LEN];     
    char *p1 = line;          
    char *p2 = line;
    int ok, ok2;
    printf("Enter a string of up to %d characters:\n", STRING_LEN);
    while((*p1++ = getchar()) != '\n');

    changeCase(line);
    puts("resulting string is:\n");
    printf("%s", line);
    stripspaces(line, p1, p2);
    ok = isinteger(line);
    if (ok)
    {
        printf("%s is an integer\n", line);
    }
    else …
Run Code Online (Sandbox Code Playgroud)

c

0
推荐指数
1
解决办法
2286
查看次数

标签 统计

c ×2