Couple questions:
1. Why is my bottom border not centered and actually displaying the underscores? And how can I be using strlen to make the bottom border correct?
2. I am stumped on how to create the bottom trunk of the tree. Do I just need to create another loop that subtracts from the lowest row?
3. When I want to start writing to a file, do I have the correct first lines of code?
4. Why,when I put in a row count of 60, does the entire program fail to correctly output a tree?
#include <stdio.h>
#include <string.h>
int main ()
{
//Variable declarations
char myString[75];
int choice = 0;
char FileName1[75];
int i;
int space;
int rows;
int k=0;
FILE *fp1;
//Ask for recipient
printf("Please enter recipient: ");
scanf("%s", &myString);
strlen("myString");
//Ask user to pick between outputting to stDout or file
printf("Please enter a number greater than zero to output to the stdOut \n or enter a number less than zero to output to a file: ");
scanf("%d", &choice);
//Displaying to stdOut
if (choice > 0){
printf("Please enter the number of rows: ");
scanf("%d", &rows);
//Christmas Tree Build
//Top of border
for (i=1;i<=2*rows+1;++i)
{
printf("_");
}
printf("\n");
//Chrsitmas Tree Build
printf("|");
for (i=1;i<=rows;++i)
{
for(space=1;space<=rows-i;++space)
{
printf(" ");
}
while(k!=2*i-1)
{
printf("*");
++k;
}
for(space=1;space<=rows-i;++space)
{
printf(" ");
}
k=0;
printf("|\n|");
}
//Bottom of border
//for (i=1;i<=(2*rows+1)-(19+ , myString);++i)
{
printf("_Happy Holidays:%s!!__|",myString);
}
printf("\n");
//Output to a file
}else{
printf("Please enter a name for your file. \n");
scanf("%s", &FileName1);
fp1 = fopen ("C:\\FileName1.txt", "w");
printf("Your Christmas card was placed here at -> C:\\%s ", FileName1);
}
return 0;
}