Sorry this sounds so lame to be asking, but I just got this program and
switched from an ancient program and this program hardly likes anything I try
to type into it soooo I am just starting from the beginning...
Do you know how to define an array?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
int main (int argc, char *argv)
{
char quit;
int I;
apvector (Numb) int <4>;
I=0;
quit = '\0';
while (quit!='q')
{
for(I=0;I<4;I++)
{
cout<<"Please enter 4 numbers";
cin>>Numb_;
cout<<"First";
gotoxy(1,5);
cout<<
}
cout<<"enter q to quit";
cin>>quit;
}
return 0;
}
that is my code so far... I just need to get the vector working and then I can
probably go from there (and I'm pretty sure the code gotoxy( , ) may not work
in this program but I figured I would try it)_
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am guessing that you took the Advanced Placement Computer
Science
course in the US between 1999 and 2003. Either that or a course based on their
'simplified' libraries. Unfortunately there are still courses that appear to
be using them! We used to get questions about this here regularly; you are the
first for some time!
The AP CompSci course ill-advisedly introduced 'simplified' non-standard class
libraries for teaching purposes. Unfortunately they did not seem to emphasise
the fact that they were proprietary classes for teaching principles, and are
not generally available in _any _ compiler; they were provided as course
specific material.
There is probably nothing different about this compiler that is causing your
problem; libraries are distinct from the compiler itself. That said I am not
sure that your syntax for declaring Numb is valid in any compiler. You have
two choices; 1) track down an implementation of the AP C++ libraries (not
recommended), 2) Learn to use the standard C++ libraries.
I am not sure why the programme felt the need to 'simplify' these libraries
rather than just teach a subset of the standard ones. Their programme may have
produced a few_ Computer Scientists_, but it has stunted the growth and
discouraged a number of Software Developers! They are probably still doing
so using Java now!
Documentation for the the standard equivalents to the AP libraries can be
found for example here or here.
One other problem is that the function gotoxy() is not a standard function.
Standard C/C++ libraries are intended to be implementatble on almost any
platform, so assume lowest common denominator functionality, and that is the
functionality of a "Dumb
Terminal". The Windows Console API has means to do this, but it is a little
more complex. A clone of Borland's DOS conio library that includes gotoxy() is
available here, but it is
probably better to wean yourself of this crutch just as it is the AP library.
The line following the gotoxy() call is incomplete (in any compiler). I guess
this code is yet incomplete.
The following compiles; I have marked-up the lines that needed
modifying/adding. It does not however seem to do any thing sensible, but I'll
leave you to fix that or open another question. I guess when you have
completed it it will work.
#include<windows.h>#include<iostream>#include<vector> ///////////////////////////////////usingnamespacestd;///// ----START----/////voidgotoxy(intx,inty);///// ----END----/////intmain(intargc,char*argv[]){charquit;intI;vector<int>Numb(4);/////////////////////////////// I=0;quit='\0';while(quit!='q'){for(I=0;I<4;I++){cout<<"Please enter 4 numbers";cin>>Numb[I];cout<<"First";gotoxy(1,5);////////////////// cout<<}cout<<"enter q to quit";cin>>quit;}return0;}///// ----START----/////voidgotoxy(intx,inty){HANDLEconsole=GetStdHandle(STD_OUTPUT_HANDLE);COORDcoord={x-1,y-1};SetConsoleCursorPosition(console,coord);}///// ----END----/////
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well the program does like the way I have been taught to code and I am
currently in and AP computer science class.... I am a brand new coder, but I
found the program that we use in that class so I am okay now. But thanks
anways.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry this sounds so lame to be asking, but I just got this program and
switched from an ancient program and this program hardly likes anything I try
to type into it soooo I am just starting from the beginning...
Do you know how to define an array?
include <iostream>
include <apvector>
using namespace std;
int main (int argc, char *argv)
{
char quit;
int I;
apvector (Numb) int <4>;
I=0;
quit = '\0';
while (quit!='q')
{
for(I=0;I<4;I++)
{
cout<<"Please enter 4 numbers";
cin>>Numb_;
cout<<"First";
gotoxy(1,5);
cout<<
}
cout<<"enter q to quit";
cin>>quit;
}
return 0;
}
that is my code so far... I just need to get the vector working and then I can
probably go from there (and I'm pretty sure the code gotoxy( , ) may not work
in this program but I figured I would try it)_
Use code tags mark-up when posting code.
I am guessing that you took the Advanced Placement Computer
Science
course in the US between 1999 and 2003. Either that or a course based on their
'simplified' libraries. Unfortunately there are still courses that appear to
be using them! We used to get questions about this here regularly; you are the
first for some time!
The AP CompSci course ill-advisedly introduced 'simplified' non-standard class
libraries for teaching purposes. Unfortunately they did not seem to emphasise
the fact that they were proprietary classes for teaching principles, and are
not generally available in _any _ compiler; they were provided as course
specific material.
There is probably nothing different about this compiler that is causing your
problem; libraries are distinct from the compiler itself. That said I am not
sure that your syntax for declaring Numb is valid in any compiler. You have
two choices; 1) track down an implementation of the AP C++ libraries (not
recommended), 2) Learn to use the standard C++ libraries.
I am not sure why the programme felt the need to 'simplify' these libraries
rather than just teach a subset of the standard ones. Their programme may have
produced a few_ Computer Scientists_, but it has stunted the growth and
discouraged a number of Software Developers! They are probably still doing
so using Java now!
Documentation for the the standard equivalents to the AP libraries can be
found for example here or
here.
One other problem is that the function gotoxy() is not a standard function.
Standard C/C++ libraries are intended to be implementatble on almost any
platform, so assume lowest common denominator functionality, and that is the
functionality of a "Dumb
Terminal". The
Windows Console API has means to do this, but it is a little
more complex. A clone of Borland's DOS conio library that includes gotoxy() is
available here, but it is
probably better to wean yourself of this crutch just as it is the AP library.
The line following the gotoxy() call is incomplete (in any compiler). I guess
this code is yet incomplete.
The following compiles; I have marked-up the lines that needed
modifying/adding. It does not however seem to do any thing sensible, but I'll
leave you to fix that or open another question. I guess when you have
completed it it will work.
Note how the use of code mark-up prevented the forum from turning the index to
the Numb array into itallics markup!
Well the program does like the way I have been taught to code and I am
currently in and AP computer science class.... I am a brand new coder, but I
found the program that we use in that class so I am okay now. But thanks
anways.