Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

Ramper

@Ramper
About
Posts
8
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • 5Queens/5Knights on 8x8 board
    R Ramper

    I am currently trying to create a program to find all possibilities for placing 5 queens and 5 knights on an 8x8 board in such a way nothing will attack anything else. There are 16 possible solutions. My problem i am encountering, is when placing queens. It is not generating all possibilities. I believe it is just taking the first instance it finds and going with that rather than examining the rest of the row for possible solutions. Here is what I have, if you could possibly help it would be greatly appreciated. #include #include using namespace std; class QueenKnight { public: QueenKnight() { queens = 0; knight = 0; row = 8; column = 8; count = 0; for(int i= 0; i

    C / C++ / MFC help json

  • Splitting string into individual words
    R Ramper

    wish it was that easy, has to be a string with a leading space and multiple spaces between words.

    C / C++ / MFC help database tutorial question

  • Splitting string into individual words
    R Ramper

    I need to Write a function that will, given an input string containing many words, split that string into individual words. For each word, the function should output the word, its starting index in the string, and its length to the console without using stream extraction operator. #include #include using namespace std; int main() { string sval = " The quick brown fox jumps over the lazy dog"; int cnt=1; int nsep = sval.find(" "); while (nsep > 0) { cout << "Word " << cnt << "=" << sval.substr(0,nsep) << endl; cnt = cnt + 1; sval = sval.substr(nsep+1); nsep = sval.find(" "); } cout << "Word " << cnt << "=" << sval << endl; #ifdef WIN32 system("pause"); #endif return(0); } Thats where i am so far, it will just split it into words but will not work if it begins with a space or if there is more than 1 space between words. I believe i need s.find_first_not_of but not sure how to incorprate it or if thats even my problem any help?

    C / C++ / MFC help database tutorial question

  • inputing string & int from file to array.
    R Ramper

    File i have the code for is like: 34 34 45 32 .... File i need to be able to get grades from is: Name 35 54 34 44 34 54 34 54 34 54 Name 34 34 ... Need help on how to somehow get the name strings into an array somehow. As i have it now it is just inputFile >> data[students][tests] which is a declared 2d array with 15 students and 10 tests.

    C / C++ / MFC data-structures question

  • inputing string & int from file to array.
    R Ramper

    Have a name followed by 10 int's and it repeats for 15 names. Have a program that will input just the int into a 2d array if no string is involved. Need to somehow input the names from the file (every 11 lines) into a seperate array. Any suggestions?

    C / C++ / MFC data-structures question

  • Inputing data from .txt to array.
    R Ramper

    there is no problem with the code that i posted. The problem i am facint is that the posted code will only read a list of integers without a student name. The .txt i need to read from is supposed to have the student name then 10 grades after then another name and another 10 grades. Don't know how to retrieve the name. Thanks

    C / C++ / MFC data-structures help

  • Inputing data from .txt to array.
    R Ramper

    I have a program that is able to take the numbers out of the .txt if it is just a list of numbers. Problem is, I have a file with Names before the grades. I believe i need to set up another array inside the first one to fill with names. The .txt file will look like: Name grade grade grade grade grade grade grade grade grade grade Name ... Have 15 Names with 10 grades under each. I guess what i'm trying to do is take the strings out of the file. Is there a way to take the strings(there is a string every 11 lines) Here is what i have now: #include #include #include #include #include #include using namespace std; const int TESTS = 10; const int STUDENTS = 15; void displayGrades( int [][TESTS] ); void getGrades( int [][TESTS]); int main() { int data[STUDENTS][TESTS] = {0}; getGrades( data ); cout <> data[student][test]; } } } void displayGrades( int data[][TESTS] ) { double testTotal = 0.0; double classTotal = 0.0; double squared = 0.0; double var = 0.0; double sdev = 0.0; int mxm = data[0][0]; int min = data[0][0]; cout << "\nGrade summary" << endl; cout << "--------------" << endl; cout << left << setw(7) << "Student" << right << setw(5) << right << "Ex1" << setw(7) << "Ex2" <

    C / C++ / MFC data-structures help

  • Inputing data from .txt to array.
    R Ramper

    I have a program that is able to take the numbers out of the .txt if it is just a list of numbers. Problem is, I have a file with Names before the grades. I believe i need to set up another array inside the first one to fill with names. The .txt file will look like: Name grade grade grade grade grade grade grade grade grade grade Name ... Have 15 Names with 10 grades under each. I guess what i'm trying to do is take the strings out of the file. Is there a way to take the strings(there is a string every 11 lines) Here is what i have now: #include #include #include #include #include #include using namespace std; const int TESTS = 10; const int STUDENTS = 15; void displayGrades( int [][TESTS] ); void getGrades( int [][TESTS]); int main() { int data[STUDENTS][TESTS] = {0}; getGrades( data ); cout <> data[student][test]; } } } void displayGrades( int data[][TESTS] ) { double testTotal = 0.0; double classTotal = 0.0; double squared = 0.0; double var = 0.0; double sdev = 0.0; int mxm = data[0][0]; int min = data[0][0]; cout << "\nGrade summary" << endl; cout << "--------------" << endl; cout << left << setw(7) << "Student" << right << setw(5) << right << "Ex1" << setw(7) << "Ex2" <

    Managed C++/CLI data-structures help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups