Sandals456's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
44 (0.07 per day)
Joined:
02-February 13
Profile Views:
632
Last Active:
User is offline Dec 02 2013 07:19 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Mazda
Dream Kudos:
0
Icon   Sandals456 has not set their status

Posts I've Made

  1. In Topic: Switch/Case question

    Posted 5 Nov 2013

    Oh thank you for the input. I used Peter's method using

            if (strcmp(user_input, "CSE" ) == 0)
            {
                    for(index = 4; index < st[index].student_depart; index++)
                            printf(st[index].student_depart);
            }
    
    


    and the same for the other three departments.
  2. In Topic: Switch/Case question

    Posted 4 Nov 2013

    Would I use CSE, MATH, BME, and CHEM as a base variable like:

    char x = "MATH"
    char y = "CSE"
    char z = "BME"
    char a = "CHEM"
    
    


    And then compare the user's input and the base variable/string?

    
    if( strcmp(user_input, x) == 0)
         for(index = 4; index < st[index].student_depart; index++)  
                     printf(st[index].student_depart);  
    
    
    
    
  3. In Topic: Switch/Case question

    Posted 4 Nov 2013

    void list_student(student_info st[], int item)
    {
            int index;
            char user_input;
    
            printf("Please enter the department which you would like to see: ");
            scanf("%s", &user_input);
    
            if (user_input == "CSE" || user_input == "cse")
                    for(index = 4; index < st[index].student_depart; index++)
                            printf(st[index].student_depart);
                                    
            else if (user_input == "CHEM" || user_input == "chem")
                    for(index = 4; index < st[index].student_depart; index++)
                            printf(st[index].student_depart);
                                    
    
            else if (user_input == "MATH" || user_input == "math")
                    for(index = 4; index < st[index].student_depart; index++)
                            printf(st[index].student_depart);
                                    
            else if (user_input == "BME" || user_input == "bme")
                    for(index = 4; index < st[index].student_depart; index++)
                            printf(st[index].student_depart);
             
            else
                    printf("Sorry, that is an invalid input");
    }
    
    


    This is what I have now...

    I get a warning saying comparison between pointer and integer.
  4. In Topic: Switch/Case question

    Posted 4 Nov 2013

    So would it just be fine using just if/else statements?
  5. In Topic: Keeping For loop running

    Posted 17 Sep 2013

    Well the N = 10 is just an example, the user will input any number between 1 and 100.

    I figured out how to print the divisors on new lines, only it prints on separate lines:
    Enter N: 10
    The divisors of N are 1  
    The divisors of N are 2  
    The divisors of N are 5  
    The divisors of N are 10
    
    


    My code now:

    N = int(input("Enter N: "))
    divisor_int = 1
    while N > 0 and N < 101 :
        if N % divisor_int == 0: 
            print ( "The divisors of N are", divisor_int,)
        divisor_int = divisor_int + 1
    else:
        print ("Error. Please enter only numbers in the range of [1,100].")
    
    
    


    I know that I have to create a loop so that when the divisors reach the user input, it is supposed to stop computing. Another loop has to verify if the number is not within the range, but I don't know what to put in...

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Sandals456 hasn't added any friends yet.

Comments

Sandals456 has no profile comments yet. Why not say hello?