Guitar fretboard program help
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Guitar fretboard program help

  1. #1
    Join Date
    Jun 2014
    Posts
    1

    Guitar fretboard program help

    So i have been wondering around the net and absorbing as much as possible about c++. I feel like i have a decent understanding of c++ but using what i have learned in a practical way is another story. I feel like the best way is just to start making a simple program. So i decided to make a name the note on the guitar fretboard and here is my code so far:

    #include <iostream>
    #include <string>
    #include <cstdlib>
    #include <ctime>
    using namespace std;




    int main(){
    srand(time(0));
    char guitarNotes[7] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g' };
    char guitarStrings[5] = { 'e', 'g', 'b', 'd', 'f' };
    int note;
    int guitarNoteAr = rand() % 7;// Used to make the array guitarNotes random
    int guitarStringAr = rand() % 5;// Used to make array guitarString random

    string exit;
    cout << "This program will help you memorize the guitar fretboard.\n";

    cout << "Type Begin to start and Exit to quit. Good luck!" << endl;

    while (cin >> exit){
    if (exit == "Begin")
    {
    cout << "Where is the " << guitarNotes[guitarNoteAr] << " note on the " << guitarStrings[guitarStringAr] << " string?" << endl;
    cin >> note;

    }
    }




    system("pause");
    return 0;
    }
    Having a bit of trouble as to how i should write the code to compare note.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,360

    Re: Guitar fretboard program help

    Could you explain (in words!) what this program should do?

    And BTW, why does your guitar contain only 5 strings (neither 6, nor 7 nor 12)?
    Victor Nijegorodov

  3. #3
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,336

    Re: Guitar fretboard program help

    When posting code, please use code tags. Go Advanced, select the code and click '#'.

    What is the user expected to reply in answer to the question? Say the question was

    Where is the b note on the f string?

    What would be the expected reply and why?
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center