Like Tree2Likes

Name to Email

This is a discussion on Name to Email within the C Programming forums, part of the General Programming Boards category; I think I may just end up using arrays, rather than spending my entire weekend figuring out if it is ...

  1. #31
    Registered User
    Join Date
    Jun 2013
    Posts
    19
    I think I may just end up using arrays, rather than spending my entire weekend figuring out if it is even vastly possible to get the desired result the way he wanted us to solve it. I can just tell him that he can't mark me down for working ahead. Thanks for all your help once again. If I get the program to work (without using arrays, files, etc.) I'll get back to you (That is, if you are even interested ). I think the reason why the assignment was assigned like this was because there are still people in my class who don't know how to use a printf function , and allowing them to attempt using things we haven't learned yet would simply be a disaster. Thanks again and sorry for taking your time.

  2. #32
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    Quote Originally Posted by Adak View Post
    Each will use getchar() and store the letters into separate chars:
    f0,f1,f2,f3,f4,f5,f6 ... f20
    l0, l1,l2,l3,l4,l5,l6 ... l20

    f="first"
    l=el, for "last".
    If the very next lesson is indeed arrays, then this is the approach to take.

    Having experienced how painful f0 = getchar(); f1=getchar(); etc is, a loop and array with f[index] = getchar() will really drive home the utility of arrays.
    sonjared likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #33
    Registered User
    Join Date
    Jun 2013
    Posts
    19
    I ended up reading my textbook and using arrays and strings. It is sooooo much easier this way! Thanks a bunch

    This is the new code and it works flawlessly.

    Code:
    
    #include <stdio.h>
    
    
    int main(void)
    
    
    {
     char ln[50];
     char fn[50];
    
    printf("Enter your firstname lastname:\n");
    
     scanf("%s", &fn);
     scanf("%s", &ln);
    
     printf("%s", ln);
     printf("_");
     printf("%s", fn);
    printf("@smc.edu");
    
    
     return 0;
    }
    
    

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C# email
    By mixalissen in forum C# Programming
    Replies: 5
    Last Post: 07-02-2008, 09:53 AM
  2. Email...
    By Junior89 in forum Windows Programming
    Replies: 2
    Last Post: 04-02-2007, 12:56 AM
  3. i got this in an email !
    By blitzkrieg in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 02-07-2003, 05:14 PM
  4. email
    By iain in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 01-13-2002, 09:57 PM
  5. email in dos
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 01-13-2002, 11:10 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21