User Profile

Collapse

Profile Sidebar

Collapse
makita18v
makita18v
Last Activity: Dec 14 '08, 10:58 PM
Joined: Oct 12 '08
Location: Utah
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • makita18v
    started a topic How do i read a file in from a vector?
    in C

    How do i read a file in from a vector?

    So my program works all right, but I can't read my information from a file into my vector, what am I doing wrong?

    Code:
    vector<char> grades;
    	grades.push_back ('A');
    	grades.push_back ('B');
    	grades.push_back ('C');
    	grades.push_back ('D');
    	grades.push_back ('E');
        
    	
    
    	// declare a place to hold scores read from a file 
    	//int scores[10]={0};
    	vector<int>
    ...
    See more | Go to post

  • makita18v
    started a topic srand()
    in C

    srand()

    So I've fixed pretty much all of my problems for my program which is supposed to seed the random number generator for rolling two dice. My program compiles, but I cannot get the random numbers to happen, and I've tried several different things. I've included all of my code, but really the only thing I can't get to work right is the random number generator, so any help would be great.

    Code:
    #include <iostream>
    #include <string>
    ...
    See more | Go to post

  • makita18v
    started a topic Vectors in C++
    in C

    Vectors in C++

    I have an assignment where the program was written for me and we had to change all of the arrays to vectors. When I got the assignment back I didn't pass it off because I needed to populate a particular vector by using the push_back function, but I can't figure it out, so I'm going to post my whole program, but I think this is the only part I need help with.

    Code:
    #include <iostream>
    #include <fstream>
    #include
    ...
    See more | Go to post

  • makita18v
    started a topic Vectors in C++
    in C

    Vectors in C++

    So I have this program where I'm supposed to change all arrays into vectors. The program takes test values and assigns grades for them. The only problem is i've tried to change them into vectors, but I'm coming up with all sorts of errors, so here is some code with the array and the vector part is what I've tried to do.

    Code:
    char grades[] = {'A', 'B', 'C', 'D', 'E'};
    	vector<char> grades; //['A', 'B', 'C', 'D', 'E'];
    ...
    See more | Go to post

  • makita18v
    replied to '=': function as left operand
    in C
    Thank you for that response I finally got my program running correctly....
    See more | Go to post

    Leave a comment:


  • makita18v
    replied to '=': function as left operand
    in C
    '=': function as left operand

    I've made some corrections to the code I posted earlier, and thanks to those that responded because I have no idea what I'm doing. But now my code comes up with an error I don't understand. Here is my code that I'm having problems with:

    Code:
    bool isLeap (int year)	
    {
    	return ((isLeap = (year) / 4) || ((isLeap = (year) / 100) && ( isLeap = (year) / 400)));
    ...
    See more | Go to post

    Leave a comment:


  • makita18v
    started a topic '=': function as left operand
    in C

    '=': function as left operand

    Hey I'm really new to programming and I can't figure out what I'm doing wrong. So I was asked to write a program that determines whether a year is a leap year or not. So I wrote the following formula in a .h file:

    bool isLeap (int)
    {
    return ((isLeap = (year) / 4) || ((isLeap = (year) / 100) && ( isLeap = (year) / 400)))

    }

    it always brings up errors that I don't understand, so if...
    See more | Go to post
No activity results to display
Show More
Working...