Thread: 9th grade CS. Dirrections and opinions

  1. #1
    Registered User
    Join Date
    Jan 2012
    Posts
    9

    9th grade CS. Dirrections and opinions

    Hello guys, I'm new on this forum. I'm Alex, 9th grade and i am 16 years old. I started to learn computer science (informatics if directely translated from my language) this year and i love it. I am one of the best students in my CS class and i would love to go to the CS olympiad this year but my teacher told me that it's no hope. They ask for minimum-intermediate knowledge about CPP and we are learning repetitive structures at class. I have to learn cpp in 2 months and i will focus on that but i dont know where to start. CS is the only subject that i enjoy studying but i am really really confused. What do you think? Shoul i focus all my time on studying CS for the next 2 months? or should i just take it easy and wait for 10th grade? Thank you for taking time to read all my grumble and excuse my bad english(i'm romanian)

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    I suggest that you take your time and learn as much as you can. two months is not nearly enough time to learn C++ in any meaningful way. I've been using C++ every day for my job for the last 4 years, and I'm still learning. You'd be better off waiting the extra year. you can get a good understanding of C++ in a year, and you would have a really good chance of doing well at the olympiad.

  3. #3
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    I was in a similar situation about 3 years ago at 15.(Though the Olympiad in my case was much easier and I got a single digit national rank).
    Though learning C++ is not a task for 2 months, you can easily learn the subset you are expected to know, if you get a good book and do not stumble on logical thinking (that is where most fail during learning programming).
    Good luck.

  4. #4
    Registered User
    Join Date
    Jan 2012
    Posts
    9

    a little help.

    i need a little bit of help. i want to know what i have to use to solve this problem. i dont want you to solve it just give me a hint. "a random number of characters and numbers will be read from the keyboard. what is the smalles number that can be formed from the numbers? write the characters in the same order but all of them have to be uppercase" i dont know how to make the characters uppcase and how to make the repetitive structure work for an undetermined number of integers. i hope it is understandable and you can help me. thank you

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    std::toupper will convert any character to its upper-case counterpart.
    Regarding flow structures, there are while loops, for loops and do while loops. Study them and make a flow chart. It isn't harder than that, really.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User
    Join Date
    Jan 2012
    Posts
    26
    it helps a lot if you take a problem and break it into smaller and smaller problems.

    "take a random number of characters and numbers from the keyboard, find the smallest number and print all characters excluding numbers in upper case in the same order"

    "take a random number of characters from the keyboard"
    "find the smallest number"
    "print the smallest number"
    "exclude all non-letters"
    "capitalize all letters"
    "print all letters"

    if any single part seems like it's just too much then only deal with part of that part.

    for the input try using the string data type in C++

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    what is the smalles number that can be formed from the numbers?
    note that it doesn't say "what is the smalles number that can be formed from all the numbers?"

    this should give you a hint, if in fact it is taken verbatim from the description of the problem.

  8. #8
    Registered User
    Join Date
    Jan 2012
    Posts
    9
    the problem is translated from romanian but at the example for the number part they say "if the given numbers are 3, 3, 4, 5, 1 then the smalles number that can be formed is 1345" so i guess the number is formed using every number only once. so if the number 5 appears 3 times tou use it only once. once again sorry for my bad english skills

  9. #9
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    in that case, it's just a matter of sorting from lowest to highest and removing duplicates. there are standard <algorithm> functions for both operations.

  10. #10
    Registered User
    Join Date
    Jan 2012
    Posts
    9
    can you guys explain me exactly what does get.int() does? and can you tell me if i can assign a number or char to a void data and then check which tipe is assigned? thank you alot

    PS: i would love some explanations on the array thing. i dont know what this code does but i would like to show me the value from the possition input from the keyboard. but for x=3 for example i get the number 153...can you explain me exactly how it works? thank you alot
    Code:
    #include <iostream>
    
    
    using namespace std;
    
    
    int main()
    {
        int array[5];
        int x;
        cin>>x;
        cout<<array[x];
        cin.ignore();
        cin.get();
    }
    Last edited by MrSpyrydus; 01-27-2012 at 03:51 PM.

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    The values contained inside variables is undefined unless initialized or are global.

  12. #12
    Registered User
    Join Date
    Jan 2012
    Posts
    9
    i still dont get it

  13. #13
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Local variables are created on the stack and are uninitialized unless you do so yourself. So they will contain whatever garbage happens to be there. Global variables are automatically zeroed if they are not explicitly initialized.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  14. #14
    Registered User
    Join Date
    Jan 2012
    Posts
    9
    i kinda got that. and for the other question: how can you determine what is input from the keyboard and assign it to a speciffic array?

  15. #15
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    What do you mean?

    int array[n]; // Where n is a constant
    std::cin >> array[x]; // Where x is another constant, and x = [0, n - 1]

    This is enough to read from the keyboard to an array.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Grade Program
    By Jbrubin in forum C Programming
    Replies: 2
    Last Post: 03-28-2011, 02:02 PM
  2. Replies: 2
    Last Post: 01-29-2011, 12:58 PM
  3. Help me pls...About computing a grade
    By Sunday in forum C Programming
    Replies: 2
    Last Post: 11-03-2007, 12:41 PM
  4. Grade Evaluator
    By Takumi8374 in forum C Programming
    Replies: 5
    Last Post: 05-24-2005, 12:01 PM
  5. Grade distribution program
    By MyTeachersANazi in forum C++ Programming
    Replies: 4
    Last Post: 03-26-2003, 09:54 PM