Like Tree1Likes
  • 1 Post By std10093

School Project Help

This is a discussion on School Project Help within the C++ Programming forums, part of the General Programming Boards category; So I am creating a project for my college programming class, and I keep running into this issue that even ...

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    7

    School Project Help

    So I am creating a project for my college programming class, and I keep running into this issue that even the teacher is apparently unable to help with. So far as he says, my code is good, the program just keeps deciding to do what it wants. Any help with this would be greatly appreciated. I have attached the project folder and a screen shot of the output so far.CISC 192 Project 2 (Bookstore Order Program).cpp
    Attached Images Attached Images  

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Behind every error that occurs in a machine, at least two human errors exist, including the error to blame the machine.

    The code is not readable enough, so copy paste your code in code tags, like this
    [code]/*your program*/[/code]
    Last edited by std10093; 02-19-2013 at 01:38 PM.
    hex_dump likes this.
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  3. #3
    Registered User
    Join Date
    Feb 2013
    Posts
    7
    Sorry, didn't realize that it distorted the image that badly.

    Code:
     // CISC 192 Project 2 (Bookstore Order Program).cpp : Defines the entry point for the console application.
    // Project for CISC 192. Creating a bookstore order program to estimate amount of books to order.
    
    #include "stdafx.h"
    #include <iostream>
    #include <string>
    #include <iomanip>
    #include <cstdlib>
    
    using namespace std;
    
    
    int _tmain(int argc, _TCHAR* argv[])
    
    // Beginning of Splash Screen
    
    {
        string resp = "x";
        string isbn = "xx";
        string title = "xx";
        string author = "xx";
        string enrollment = "xx";
        string status = "xx";
        string requirement = "xx";
        string order = "xx";
    
        system ("cls");
        cout << endl;
        cout << setw(53) << "San Diego Miramar College" << endl;
        cout << endl;
        cout << setw(52) << "Bookstore Order Program" << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << setw(48) << "Revision #: 1.0" << endl;
        cout << endl;
        cout << setw(52) << "Program By: Joshua Hess" << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << setw(53) << "Press <ENTER> To Continue";
        getline(cin, resp);
    
    // End of Splash Screen
    // Start of Input Screen
    
        system ("cls");
        cout << endl;
        cout << setw(53) << "San Diego Miramar College" << endl;
        cout << endl;
        cout << setw(52) << "Bookstore Order Program" << endl;
        cout << setw(44) << "Rev# 1.0" << endl;
        cout << endl;
        cout << endl;
        cout << "  Enter The Book ISBN:   " << getline (cin, isbn);
        cout << "  Enter The Book Title:  " << getline (cin, title);
        cout << "  Enter The Book Author: " << getline (cin, author);
        cout << endl;
        cout << endl;
        cout << setw(79) << "------------------------------------------------------------------------------" << endl;
        cout << endl;
        cout << endl;
        cout << "  Enter The Estimate Enrollment: " << getline (cin, enrollment);
        cout << "  Enter New or Used Book (N / U): " << getline (cin, status);
        cout << "  Enter Required or Not Required (R / NR): " << getline (cin, requirement);
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << setw(53) << "Press <ENTER> To Continue";
        getline(cin, resp);
    
        // End of Input Screen
        // Start of Output Screen
        
        return 0;
    }
    I am also getting this on the output:

    'CISC 192 Project 2 (Bookstore Order Program).exe': Loaded 'C:\Users\Omega86\Desktop\College\CISC 192 Project 2 (Bookstore Order Program)\Debug\CISC 192 Project 2 (Bookstore Order Program).exe', Symbols loaded.
    'CISC 192 Project 2 (Bookstore Order Program).exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
    'CISC 192 Project 2 (Bookstore Order Program).exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
    'CISC 192 Project 2 (Bookstore Order Program).exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
    'CISC 192 Project 2 (Bookstore Order Program).exe': Loaded 'C:\Program Files\Bitdefender\Bitdefender 2013\active virus control\Avc3_00174_002\avcuf32.dll', Cannot find or open the PDB file
    'CISC 192 Project 2 (Bookstore Order Program).exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
    'CISC 192 Project 2 (Bookstore Order Program).exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
    'CISC 192 Project 2 (Bookstore Order Program).exe': Loaded 'C:\Windows\SysWOW64\apphelp.dll', Cannot find or open the PDB file
    'CISC 192 Project 2 (Bookstore Order Program).exe': Loaded 'ImageAtBase0x4a180000', Loading disabled by Include/Exclude setting.
    'CISC 192 Project 2 (Bookstore Order Program).exe': Unloaded 'ImageAtBase0x4a180000'
    'CISC 192 Project 2 (Bookstore Order Program).exe': Loaded 'ImageAtBase0x4a150000', Loading disabled by Include/Exclude setting.
    'CISC 192 Project 2 (Bookstore Order Program).exe': Unloaded 'ImageAtBase0x4a150000'
    The program '[5424] CISC 192 Project 2 (Bookstore Order Program).exe: Native' has exited with code 0 (0x0).

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    2,503
    that output looks normal. are you also getting the output you expect?

  5. #5
    Registered User
    Join Date
    Feb 2013
    Posts
    7
    No, it keeps loading a string of characters when I am asking for input to the strings. IE in ISBN it outputs 5080E8E8 on the input screen and doesn't allow for any user input.

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    2,503
    Quote Originally Posted by Joshua Hess View Post
    Code:
    cout << "  Enter The Book ISBN:   " << getline (cin, isbn);
    you can't do that.

    std::getline() returns a reference to the std::istream passed to it. sending an std::istream to cout is probably not what you want to do. you need to make the calls to getline separate statements from the output to cout.

  7. #7
    Registered User
    Join Date
    Feb 2013
    Posts
    7
    Quote Originally Posted by Elkvis View Post
    you can't do that.

    std::getline() returns a reference to the std::istream passed to it. sending an std::istream to cout is probably not what you want to do. you need to make the calls to getline separate statements from the output to cout.
    Ahh, that makes sense. Funny though since the teacher is the one that said to do that... oh well, i'll try that now

  8. #8
    Registered User
    Join Date
    Feb 2013
    Posts
    7
    Alright, well I got that figured out, and moved on to the output screen finally. I am able to enter the figures that I want, but it also outputs more than should be in the string.

    My current code is:

    Code:
    // CISC 192 Project 2 (Bookstore Order Program).cpp : Defines the entry point for the console application.
    // Project for CISC 192. Creating a bookstore order program to estimate amount of books to order.
    
    #include "stdafx.h"
    #include <iostream>
    #include <string>
    #include <iomanip>
    #include <cstdlib>
    
    using namespace std;
    
    
    int _tmain(int argc, _TCHAR* argv[])
    
    // Beginning of Splash Screen
    
    {
        string resp = "x";
        string isbn = "xx";
        string title = "xx";
        string author = "xx";
        string enrollment = "xx";
        string status = "xx";
        string requirement = "xx";
        string order = "xx";
    
        system ("cls");
        cout << endl;
        cout << setw(53) << "San Diego Miramar College" << endl;
        cout << endl;
        cout << setw(52) << "Bookstore Order Program" << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << setw(48) << "Revision #: 1.0" << endl;
        cout << endl;
        cout << setw(52) << "Program By: Joshua Hess" << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << setw(53) << "Press <ENTER> To Continue";
        getline(cin, resp);
    
    // End of Splash Screen
    // Start of Input Screen
    
        system ("cls");
        cout << endl;
        cout << setw(53) << "San Diego Miramar College" << endl;
        cout << endl;
        cout << setw(52) << "Bookstore Order Program" << endl;
        cout << setw(44) << "Rev# 1.0" << endl;
        cout << endl;
        cout << endl;
        cout << "  Enter The Book ISBN:   ";
        getline(cin, isbn);
        cout << "  Enter The Book Title:  ";
        getline(cin, title);
        cout << "  Enter The Book Author: ";
        getline(cin, author);
        cout << endl;
        cout << endl;
        cout << setw(79) << "------------------------------------------------------------------------------" << endl;
        cout << endl;
        cout << endl;
        cout << "  Enter The Estimate Enrollment: ";
        getline(cin, enrollment);
        cout << "  Enter New or Used Book (N / U): ";
        getline(cin, status);
        cout << "  Enter Required or Not Required (R / NR): ";
        getline(cin, requirement);
        cout << endl;
        cout << endl;
        cout << endl;
        cout << endl;
        cout << setw(53) << "Press <ENTER> To Continue";
        getline(cin, resp);
    
        // End of Input Screen
        // Start of Output Screen
    
        system ("cls");
        cout << endl;
        cout << setw(53) << "San Diego Miramar College" << endl;
        cout << endl;
        cout << setw(52) << "Bookstore Order Program" << endl;
        cout << setw(44) << "Rev# 1.0" << endl;
        cout << endl;
        cout << setw(26) << "ISBN : " << cout << isbn << endl;
        cout << setw(26) << "Title : " << cout << title << endl;
        cout << setw(26) << "Author : " << cout << author << endl;
        cout << endl;
        cout << setw(79) << "------------------------------------------------------------------------------" << endl;
        cout << endl;
        cout << setw(38) << "Projected Number of Books To Order" << endl;
        cout << setw(78) << "For required books: Expected percentage of students buying a new book" << endl;
        cout << setw(43) << "at 47%, and 35% purchasing if used." << endl;
        cout << setw(77) << "For non-required books: Expected percentage of students buying a new" << endl;
        cout << setw(48) << "book at 26%, and 10% purchasing if used." << endl;
        cout << endl;
        cout << setw(29) << "Expected Enrollment: " << cout << enrollment << endl;
        cout << setw(36) << "Book Status (N=New,U=Used): " << cout << status << endl;
        cout << setw(40) << "Required / Not Required (R/NR): " << cout << requirement << endl;
        cout << endl;
        cout << setw(47) << "Books To Order: " << cout << order << endl;
        cout << endl;
        cout << setw(53) << "Press <ENTER> To Continue";    
        getline(cin, resp);
    
        return 0;
    }
    Also, I included an image of the output, hopefully this one is a bit clearer than my earlier attempt.Name:  Output Error.jpg
Views: 104
Size:  83.4 KB

    During this attempt I did not enter any values, and the base value should have been "xx" as defined in the beginning but it's not. Also, any value I enter for those strings just adds on to the 6C3BED48 that is for some reason in them.

    Thank you again for any help.

  9. #9
    Registered User
    Join Date
    Oct 2006
    Posts
    2,503
    Quote Originally Posted by Joshua Hess View Post
    Code:
    cout << setw(26) << "ISBN : " << cout << isbn << endl;
    cout should only be at the beginning of the line. you only need one.

  10. #10
    Registered User
    Join Date
    Feb 2013
    Posts
    7
    Thank you, that's the issue I was having. Now to just figure out the rest of it lol. I appreciate all the help from here.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. School project help
    By blckgoat in forum C Programming
    Replies: 8
    Last Post: 11-14-2011, 05:03 PM
  2. School Mini-Project on C/C++ (Need Your Help)..
    By EazTerence in forum C++ Programming
    Replies: 4
    Last Post: 09-08-2005, 01:08 AM
  3. school project help
    By yogai in forum C Programming
    Replies: 8
    Last Post: 09-09-2004, 06:03 PM
  4. Help with School Project
    By jtouron in forum C++ Programming
    Replies: 2
    Last Post: 10-10-2003, 12:27 AM
  5. school project been killin me..
    By oldsaintd in forum C Programming
    Replies: 1
    Last Post: 03-18-2003, 02:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21