Tsukuyomi's Profile User Rating: -----

Reputation: -3 Dishonored
Group:
Active Members
Active Posts:
102 (0.07 per day)
Joined:
22-February 11
Profile Views:
2,832
Last Active:
User is offline Jan 10 2015 01:56 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Tsukuyomi has not set their status

Posts I've Made

  1. In Topic: Iterators problems

    Posted 31 Dec 2014

    View PostAnarion, on 26 December 2014 - 06:08 PM, said:

    std::vector::begin() returns a random access iterator, which does not support addition of two iterators by using operator+ and therefore, your code does not compile. The supported arithmetics for a random access iterator are:
    • iterator + integer
    • integer + iterator
    • iterator - integer
    • iterator - iterator


    Though as CTphpnwb said, what you are doing in that line does not make sense aside from calling an undefined operator+.


    vector<int> iter = inputVec.begin();
    
    	std::advance(iter, (inputVec.end()-2));
    
        //get the second from last element
       // auto itSecondLast = ;
    
        //add first and last element
        auto sum1 = inputVec.begin() + inputVec.end();
        auto sum2 = inputVec.begin() + iter;
    	cout<<"\nThe sum of the first and last element using iterators is "<<sum1<<endl;
    	cout<<"The sum of the second element and second from the last element using iterator is "<<sum2<<endl;
    
    



    STILL got Errors:

    no match for 'operator+' (operand types are 'std::vector<int>::iterator {aka __gnu_cxx::__normal_iterator<int*, std::vector<int> >}' and 'void')	
    no matching function for call to '__iterator_category(std::vector<int>&)'	
    
    no type named 'difference_type' in 'struct std::iterator_traits<std::vector<int> >'	
     
    no type named 'iterator_category' in 'struct std::iterator_traits<std::vector<int> >'	
    
  2. In Topic: SQL Create tables Error

    Posted 27 Apr 2014

    I solve it. Thanks everyone for your help :bigsmile:
  3. In Topic: SQL Create tables Error

    Posted 27 Apr 2014

    Thanks. I removed the colon on line 13 but I stay have an error:

    Quote

    mysql> source Tables2.sql
    Database changed
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ': VARCHAR(30),
    IncreaseStudyTime VARCHAR(30),
    WorkOnAssignm' at line 11
  4. In Topic: SQL Create tables Error

    Posted 27 Apr 2014

    View Postandrewsw, on 27 April 2014 - 06:09 AM, said:

    That error is exactly the same so I suspect that you are still running the previous version of the statement.

    Thanks I fixed that. I have an error for one of my other tables. Here is the code:

    use myDatabase;
    
    CREATE TABLE Page2(
    UnderstandingConcepts									VARCHAR(30),
    FailureToTakeTests										VARCHAR(30),
    ListeningProblems										VARCHAR(30),
    FailureToTurnInAssignment								VARCHAR(30),
    InadequateStudyHabit									VARCHAR(30),
    WritingSkills											VARCHAR(30),
    PoorPerformanceOnAssignment								VARCHAR(30),
    ExcessiveAbsences										VARCHAR(30),
    LowTestScores											VARCHAR(30),
    Other:													VARCHAR(30),
    IncreaseStudyTime										VARCHAR(30),
    WorkOnAssignments										VARCHAR(30),
    HelpWithAssignment										VARCHAR(30),
    HelpWithSubjectMatterComprehensionUnderstanding			VARCHAR(50)
    );
    
    



    HERE IS THE ERRORS:

    mysql> source Tables2.sql;
    Database changed
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ': VARCHAR(30),
    IncreaseStudyTime VARCHAR(30),
    WorkOnAssignm' at line 11
  5. In Topic: SQL Create tables Error

    Posted 27 Apr 2014

    View Postandrewsw, on 27 April 2014 - 05:51 AM, said:

    You have an extra comma on line 10.


    Do you mean I have to take off the last comma. Like this:

    use myDatabase; 
    
    CREATE TABLE Page3(
    TeachingAndLearningCenter								VARCHAR(30),
    ConferenceWithInstructor								VARCHAR(30),
    ProblemSolvingSkills									VARCHAR(30),
    ConferenceWithCounselor									VARCHAR(30),
    ReadingSkills											VARCHAR(30),
    WritingSkills											VARCHAR(30),
    ComputationSkills										VARCHAR(30)
    );
    
    


    I did the above but I got this error:

    mysql> source Tables3.sql;
    Database changed
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 9

My Information

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

Contact Information

E-mail:
Private

Friends

Comments

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