1. Engineering
  2. Computer Science
  3. trying to create a c program on unix on my...

Question: trying to create a c program on unix on my...

Question details

Trying to create a C program on Unix on my Mac that says " "{Hello/\Welcome back to IU!}, This is Spring 2019's 1st 8 Week Course" " once and then starts a new line and print your name followed by 5 dots (one dot every 2 seconds), followed by newline. I am trying to have quotes inside of the print statement also. Here is my code:

/*

* Basic C program to print out hello world!

* Author: Joseph Forrow

*/

#include <stdio.h>

/* include <unistd.h> for the sleep function */

#include <unistd.h>

int main() {

printf("{Hello/\\Welcome back to IU!, This is Spring 2019's 1st 8 Week Course}");

/*Couldnt get the dots to appear one at a time every two seconds but they all appear together along with my name */

int d = 0;

/*used "(;;) in my for loop as this is an infinite loop with no conditional expression, perfect for this part of the assignment. */

for (;;) {

   printf("\n");

   printf("Joseph Forrow");

/* for loop to so the dots start at zero, maximum of five, and d++ is for increment of the control variable d */

for(d = 0; d<5; d++) {

   sleep(2);

   printf(".");

}

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution