damn i need help!

could someone help me and tell whats wrong with this code.
its for a class but i cannot tell what is wrong.

#include
#include
#include
#include
using namespace std;

int main(void)
{
int studentIDs[6]; //initialize all arrays leaving space
string lastNames[10]; // for the terminating 0;
string firstNames[15];
int exams[18];
int projects[24];
int finals[6];
ofstream outPut;

cout << "+ Student Grade Calculator +"; // tell the user what this program will do.

cout << "The Students First Name:";
cin.get(firstNames[0],15);cin.ignore(200,'
');
cout << firstNames[0];
return 0;
}


Comments

  • : could someone help me and tell whats wrong with this code.
    : its for a class but i cannot tell what is wrong.

    Beginning like this:
    #include
    #include
    #include
    #include



  • : could someone help me and tell whats wrong with this code.
    : its for a class but i cannot tell what is wrong.
    :
    : #include
    : #include
    : #include
    : #include
    : using namespace std;
    :
    : int main(void)
    : {
    : int studentIDs[6]; //initialize all arrays leaving space
    : string lastNames[10]; // for the terminating 0;
    : string firstNames[15];
    : int exams[18];
    : int projects[24];
    : int finals[6];
    : ofstream outPut;
    :
    : cout << "+ Student Grade Calculator +"; // tell the user what this program will do.
    :
    : cout << "The Students First Name:";
    : cin.get(firstNames[0],15);cin.ignore(200,'
    ');
    : cout << firstNames[0];
    : return 0;
    : }
    :
    :
    :

    I have modified your code to read the following:

    [code]
    #include<iostream>
    #include
    #include
    #include

    int main(void)
    {
    int studentIDs[6]; //initialize all arrays leaving space
    char lastNames[10]; // for the terminating 0;
    char firstNames[15];
    int exams[18];
    int projects[24];
    int finals[6];
    ofstream outPut;

    std::cout << "+ Student Grade Calculator +"; // tell the user what this program will do.

    std::cout << "The Students First Name:";
    std::cin.getline(firstNames,15);
    std::cin.ignore(200,'
    ');
    std::cout << firstNames;

    return 0;
    }
    [/code]

    This works!

    Hope this helps,


  • hey i cannot help u but u sure can help me..i am using turbo C++ version 3 compiler and when i try to use 'string' as data type it gives me a error..how can i fix it and use the string dadta type ..
    neo
  • I dont think TC++3 sopports that class.


  • hey buddy,
    thankx tikoo..i suspect that might be the case..hence kamiccolo, coould you please tell me which compiler are you using coz i am just a beginner with turbo C++ version 3 and i cant seem to use "String " data type..incase u r using the same compiler as mine, could you advice me on the necessary settings that i shud check..thanks
    Neo

    : could someone help me and tell whats wrong with this code.
    : its for a class but i cannot tell what is wrong.
    :
    : #include
    : #include
    : #include
    : #include
    : using namespace std;
    :
    : int main(void)
    : {
    : int studentIDs[6]; //initialize all arrays leaving space
    : string lastNames[10]; // for the terminating 0;
    : string firstNames[15];
    : int exams[18];
    : int projects[24];
    : int finals[6];
    : ofstream outPut;
    :
    : cout << "+ Student Grade Calculator +"; // tell the user what this program will do.
    :
    : cout << "The Students First Name:";
    : cin.get(firstNames[0],15);cin.ignore(200,'
    ');
    : cout << firstNames[0];
    : return 0;
    : }
    :
    :
    :

  • i suspect the same ..could you advice me on which compiler wud be a good choice..
    neo
  • Hi,

    If you want a compiler then I would recommend dev 4.9.5.0. You could download this from the following website:

    www.bloodshed.net/
  • i used POS Visual C++,
    im gonna try this bloodshed thing it looks cool
  • : hey buddy,
    : thankx tikoo..i suspect that might be the case..hence kamiccolo, coould you please tell me which compiler are you using coz i am just a beginner with turbo C++ version 3 and i cant seem to use "String " data type..incase u r using the same compiler as mine, could you advice me on the necessary settings that i shud check..thanks
    : Neo
    :
    : : could someone help me and tell whats wrong with this code.
    : : its for a class but i cannot tell what is wrong.
    : :
    : : #include
    : : #include
    : : #include
    : : #include
    : : using namespace std;
    : :
    : : int main(void)
    : : {
    : : int studentIDs[6]; //initialize all arrays leaving space
    : : string lastNames[10]; // for the terminating 0;
    : : string firstNames[15];
    : : int exams[18];
    : : int projects[24];
    : : int finals[6];
    : : ofstream outPut;
    : :
    : : cout << "+ Student Grade Calculator +"; // tell the user what this program will do.
    : :
    : : cout << "The Students First Name:";
    : : cin.get(firstNames[0],15);cin.ignore(200,'
    ');
    : : cout << firstNames[0];
    : : return 0;
    : : }
    : :
    : :
    : :
    :
    :
    hey buddy try using visual c++ 6.0 compiler.namespace fn is supported by vc 6.0.u might b able to find a soln
  • cin.get(firstNames[0],15);
    must be
    getline(cin,firstNames[0]);

    and whats the terminating zero comment supposed to mean?
    you are not to worry how string internally manages its data.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories