-3
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*username/password/id storage*/
struct Profile
{
char username[50];
char password[10];
char id;
};
struct Profile profile1; /*User Profile */
main(){
char firstname[79];
char answer1[4];
char y[4] = "Yes";
char username[50];
printf(" Welcome to Iceburg\n Working for you\n\n\n\n");
printf("Is this your first time using our program?(Yes/No)\n");
scanf("%d", &answer1);
if (answer1 == y){
goto start;
}
else{
goto end;
}
start:
/*Beginning of program*/
printf(" Welcome to Iceburg\n Working for you\n\n\n\n");
printf("Please enter your first name\n");
scanf("%s", &firstname);
system("cls");
printf("Hello %s,\nWelcome to Iceburg\n\n", firstname);
/*Collecting data for username/password*/
printf("First, we need some other data.\n");
printf("Select a username.(one word with no special characters)\n");
scanf("%s", &username);
printf("Thank you!\n");
end:
return(0);
}
我需要程序的帮助直到“start:”。由于程序 签出没有错误,但不会运行if else语句,因此我不知道要在哪里转向。如果我能得到一些帮助。我也 需要知道我需要做什么才能创建用户名/密码 登录用户名和密码保存在此 源或备用源中。程序开始不能正常工作
您正在比较字符串与==,初学者。另外,你使用的是“goto”。 –
此外,您还传递'char'数组,其中'scanf'需要''%d“'指向'int'的指针。 – Kninnug
goto end的用途是什么?跳转到'return 0;'?这根本没有意义,而'return(0);',当'return'不是函数时。 –