printf("**************************\n\n"
"//logo\t\t\t\tWelcome to MSYBank\n\n"
"\t\t\t\t\t\t%s\n%s\n"
"**************************",date,currTime\n\n);
printf("Hi, what is your name? ");
scanf("%[ A-Z a-z ]s \n",&userName);
system("cls");
printf("Welcome to MSYBank, %s !\n",userName);
printf("Please select your option: \n");
if(display=fopen("display.txt","w"))==NULL)
{
printf("File could not be opened.\n");
}
else
{
while((options=enterOptions())!=3)
{
switch(options)
{
case 1:
display();
break;
case 2:
calculate();
break;
case 3:
system("cls");
print("TQ visiting. have a nice day!^^");
default:
printf("Incorrect options\n");
break;
}
}
fclose(display);
}
return 0;
)
void displays(FILE*displayR)
{
FILE*displayW;
struc display={Tenor(months),interestRate};
if((displayW=fopen("displays.txt","w"))==NULL)
{
printf("File could not be opened.\n");
}
else
{
rewind(displayR);
fprintf(displayW,"%-6d%-16lf\n","Tenor","interestRate");
int enterOption(void)
{
menuOptions;
printf("Here are your options\n\n"
"\tOptions\t\tFunction\n"
"\t1\t\tDisplay Interest Rate\n"
"\t2\t\tCalculate Interest Earn\n"
"\t3\t\tExit\n\n"
"Please select your option.\n");
scanf("%d"menuOption);
return menuOptions;
}
I couldn`t run it, wonder what`s wrong >< please check for me..
Compiler messages are usually a godsend. Try posting the errors your compiler gave. Also, use the <> button to wrap your code in code tags. It will make helping you a lot easier.
Some things I noticed:
-I don't think you can write string literals on separate lines like:
1 2
printf("Hello ""There");
-You are missing a comma on your last scanf() call.
-I don't understand what you are trying to do with:
Uhm.. printf calculate("InterestRate.txt"); should be this, forgot to type it in.. So, for the string literals- I have to type them all to a single line? :O
Errors:-
-Expected '=',',',';' 'asm' or '_attribute_'before '<' token
-ISO C does not allow extra ';' outside of a function
-In function 'displays':
-Expected declaration specifiers before 'if'
-stray '\' in program
-stray '\' in program
Thanks for clarifying firedraco. And no, Sunli, you don't have to type it all on one line. I was wrong.
Following the error messages:
1) The first error is pretty blatant now that I see it. You forgot "#" on the third include.
2) When you defined your struct, you missed the "t" at the end of the keyword.
3) On two lines, you have "If calculate()" which makes no sense. If this is supposed to be one name, then you need an underscore: "If_calculate()." Plus, the compiler only caught this error because you forgot your semi-colons in your prototypes, so it thought the first "display" was the function definition and not a prototype.
4) In your first call to printf, your last variable is "currTime\n\n," which also makes little sense. Your variable is currTime, and if you wanted a new line, you should have put that inside the string literal and not the variable, i.e. "\t\t\t\t\t\t%s\n%s\n\n\n"/*...*/, date, currTime);
You should be looking over your code more carefully before asking for help. Some of the errors were due to typos which you would have been able to spot easily.
Uhmm thanks, I did noticed I forgot to put '#' on third include and the 't' for struct after posting the errors :x I`ll try to fix it and see if there`s still any errors, thanks daleth :)