Hey there! Sign in to join this conversationNew here? Join for free
    • Thread Starter
    Offline

    0
    ReputationRep:
    I don't really understand c++, I'm only doing one module of it and I don't really want to do it again, but I need to pass and I just can't get my head around what I need to do for this work. Any help would be appreciated.
    Attached Images
     
    Offline

    18
    ReputationRep:
    (Original post by pwookie)
    I don't really understand c++, I'm only doing one module of it and I don't really want to do it again, but I need to pass and I just can't get my head around what I need to do for this work. Any help would be appreciated.
    Learn basic C++, these are extremely basic tasks.
    http://www.sololearn.com/Play/CPlusPlus#_=_
    This website makes it fun to learn C++
    Offline

    17
    ReputationRep:
    (Original post by pwookie)
    I don't really understand c++, I'm only doing one module of it and I don't really want to do it again, but I need to pass and I just can't get my head around what I need to do for this work. Any help would be appreciated.
    Lol they arn't going enthuse people about coding with that sleeping pill of an assignment.

    Heres some ideas on the first 2. The third needs too much deciphering for me to bother with but it doesn't look too bad look- up characters in char arrays to get the correct position-to-character mapping. Q4,Q5 are trivial and 6 cant read the whole thing.

    Code might need some tweaking to work as I don't really code in c++.

    If I remember correctly you can cast a char into its ASCII value integer. The isInAlphabet() function uses that assumption.

    1)
    Code:
    bool isInAlphabet(char input){
      int asciiVal = (int)input;
      
      if(asciiVal >=65 && asciiVal<=90) //only lowercase will need another condition for uppercase/space.
        return true;
      else
      return false;
     
    }
    2)
    Code:
    bool isPermutation(string input){
    
       for(int i =0; i<input.length;i++){
         if(!isInAlphabet(input[i])
         	return false;
       }
    
       return true;
    }
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    What's your favourite Christmas sweets?
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.