lundi 12 juin 2017

What is wrong with my code? Error expected identifier or '('

This is an interesting code basically I'm trying to do that silly thing where you ask someone their name and then ask them to spell it. If they spell out it then you tell them that you actually spell it (what they put in as their name) and vice versa. I get an error at line 7:1 so the first curly bracket. It's the error expected identifier or '('. Thanks so much for your help!

#include <stdio.h>
#include <cs50.h>

string it(void);
int main(void);

{
    do 
    {
        printf("What's your name? ");
        string name = get_string();
    }

    while (name = NULL)

   do
   {
        printf("How do you spell it?");
        string spelling = get_string();
   }

   while (spelling = NULL)

   if (name = spelling)
    {
        printf("No it's spelled 'it'.");
    }

    else if (spelling = it)
    {
        printf("No it's spelled %s",name);
    }

    else
    {
        printf("That's wrong on so many levels.\n");
    }
}




Aucun commentaire:

Enregistrer un commentaire