jimblumberg's Profile User Rating: *****

Reputation: 4219 Guru
Group:
Mentors
Active Posts:
13,982 (7.81 per day)
Joined:
25-December 09
Profile Views:
69,254
Last Active:
User is offline Today, 03:48 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
50
Expert In:
C/C++

Latest Visitors

Icon   jimblumberg has not set their status

Posts I've Made

  1. In Topic: Structure help

    Posted 20 Nov 2014

    Quote

    I'm just using the functions we were given to use.

    Don't be afraid to create and use your own functions, functions can often be used to simplify the logic of your programs.


    Jim
  2. In Topic: Structure help

    Posted 20 Nov 2014

    Have you considered a vector or an array to help reduce the code duplication? Any time I see variables with numeric suffixes I think vectors or arrays should be considered. Also your divisions could be arrays as well. A couple more functions may be useful as well.

    Jim
  3. In Topic: Receiving information from a file.

    Posted 20 Nov 2014

    Post your current code so we can possibly see what is wrong.


    Jim
  4. In Topic: Struggle with strings C.

    Posted 20 Nov 2014

    Except that that code shouldn't compile without at least some warnings:

    Quote

    ||=== c_homework, Debug ===|
    main.c||In function ‘main’:|
    main.c|9|error: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration]|
    main.c|19|error: implicit declaration of function ‘system’ [-Wimplicit-function-declaration]|
    ||=== Build finished: 2 errors, 0 warnings (0 minutes, 0 seconds) ===|


    You should never use gets() this function is so dangerous that it has been removed from the current C standard. You should be using fgets() instead. You also need the <stdlib.h> header file if you want to use the system() function.


    Jim
  5. In Topic: I am not sure what my next step is..

    Posted 19 Nov 2014

    Quote

    And I am sorry about the code tags :'( I do not know how or where to place them when I type my program in


    You press the [ code ] button at the top of the editor window and paste the code between the tags.

    :code:

    It seems that you are close at implementing the first part of the assignment. But you still have the name of the array incorrect, it should be named score, if you follow the directions.

    For the second part of the assignment you really need to show what you've tried. And ask specific questions about the parts you don't understand.

    Look at this snippet:
    	cout << "The average of the scores is " << sum / SCORE << endl;
    	
    	for ( i = 0; i < SCORE; i++) // This is incorrect.
    	{    
    	   cout << i << grade[i] << endl;
    		if ( grade[i] < 89){
    			cout << grade[i] << "A\n" ;
    		if ( 90 < grade[i] && grade[i] < 79)
    			cout << grade[i] << "B\n" ;
    		if ( 80 < grade[i] && grade[i] < 69)
    			cout << grade[i] << "C\n" ;
    		if ( 70 < grade[i] && grade[i] < 59)
    			cout << grade[i] << "D\n" ;
    		if ( 60 < grade[i] && grade[i] < -1)
    			cout << grade[i] << "F\n" ;
    
    		if (grade[i] < average)
    			// place *.....still figuring this part out
    		}
    	}
    


    The comparison part of your if statement is incorrect, you need to stop when you reach the number of actual grades you entered, not at the SIZE of the array. Your if statement testing if the grade is less than the average should be before you print out each grade. Also the testing for the "letter" could be an if/else if() chain instead of multiple if statements. And the last statement should be an else, and the grade will never be less than zero. If you work your logic correctly you only need one test for each series.

    if( x < 1)
      do something
    else if( x < 2)
      do something else.
    else
      last chance.
    
    


    Jim

My Information

Member Title:
Age:
Age Unknown
Birthday:
December 6
Gender:

Contact Information

E-mail:
Private

Comments

Page 1 of 1
  1. Photo

    modi123_1 Icon

    17 Nov 2014 - 08:11
    I like brocken's comment "I don't know much about coding, but it would be really easy".
    Heh.. I don't know anything about the topic, but I know it is easy.
    Riiiiiiiiiight.
  2. Photo

    brockenglass101 Icon

    22 Oct 2014 - 02:34
    I know that this isn't what this site is for but many people in the pc gaming comunity have been looking for screen magnification program that would zoom in on the center of the screan rather then the cursor (turned on and off with a hotkey). Now, I am not going to lie, I don't know much about coding, but it would be really easy to make program like this one.
    I hope you will find ...
  3. Photo

    KnifeTea Icon

    11 May 2014 - 05:55
    thanks for the help Jim!
  4. Photo

    tarmizi_adam2005 Icon

    04 Dec 2013 - 07:15
    Just stopping by to say Hello Jim. I've learned quite a few things from your posts in the c/c++ forum.
Page 1 of 1