Tuesday, July 14, 2009

I just want someone help me out to run a simple java program. Before giving the answer please read details.?

I made a simple Java program in NOTEPAD with the name Example.java and saved it in the following path C:\Java\Jdk1.5.0_13\bin\example.java. The coding is:- class example{


public static void main(string args[]){


system.out.println("this is my first program");}


}


I have downloaded the Java Developer Kit Jdk1.5.0_13 from the sunmicrosystems' website as one of my friend specified. In order to compile the program, I opened MS-DOS and went to the bin folder and type as followa:- C:\Java\Jdk1.5.0_13\bin%26gt;javac example.java and hit the ENTER Key. It displayed some error. The output was :-


example.java:2: cannot find symbol


symbol: class string


location: class example


public static void main(string args[])


example.java:4: package system does not exist


system.out.println("this is my first program");


2 errors





Please help me out to run this program.

I just want someone help me out to run a simple java program. Before giving the answer please read details.?
Java is a case-sensitive language. That means that upper-case letters are not the same as lower-case letters.





In your case, String and System have both got to have a capital S for the program to work.





Hope this helps!
Reply:class Example


{


public static void main(String args[])


{


System.out.println("this is my first program");


}


}
Reply:You just made a few mistakes. System has a capital 's'. Secondly you named you file with a capital 'e' so it should be javac Example.java string should also have a capital 's'


I'm having lots of trouble with my computer sci class. Can someone help me with this midterm problem?

What is the output from the following Java program fragment?





public static void main(String[] args)


{


int A = 10;


int B = 20;


Update(A, B);


System.out.println(A + " " + B);


}





public static void Update (int X, int Y)


{


X = X + Y;


Y = Y + X;


System.out.println(X + " " + Y);


}





A. None; there is a run-time error (before any output is produced)





B. 10 20


10 20





C. 10 20


30 50





D. 30 50


10 20





E 30 50


30 50

I'm having lots of trouble with my computer sci class. Can someone help me with this midterm problem?
Where are you stuck? Let us know what you think the answer should be and why.
Reply:D. 30 50


10 20





The variables are not passed by reference so they do not change in main.
Reply:D

flower girl dresses

Programming Help?

public class StringStuff{


String myString;


/**


*This constructor sets the instance variable equal to my name.


*/


public void StringStuff(){


myString = "Jacob";


}





/**


*This method accepts a String as a parameter and prints to the screen whether or not it contains more characters than your instance variable. Nothing is returned.


*/


public void whichIsLonger(String s){


int x=s.length();


int y=myString.length();


if (x%26gt;y){


System.out.println("The String s contains more letters than myString.");


}


else{


System.out.println("The string s does not contain more letters than myString.");


}


}


/**


*This method prints the second to last character in it to the screen.


*/


public void secondToLast(){


int z=myString.length();


z=z-2;


char c=myString.charAt(z);


System.out.println(c);


}


public static void main(String[]args){


StringStuff e = new StringStuff();


e,whichIsLonger("Ferret");


e.secondToLast();


}

Programming Help?
/**


*This constructor sets the instance variable equal to my name.


*/


public void StringStuff(){


myString = "Jacob";


}








This is not a constructor. This is just an ordinary method that happens to have the same name as the class. Thus, it won't be called when you say new StringStuff().





A constructor must not have a return type. Remove void.


Should be:


public StringStuff(){


myString = "Jacob";


}





Hope this helps.


Matching lowercase and uppercase in c++?

I'm writing a program a class for making menus just for practice, I use some code (shown below) to match what the user inputed to an array of names. My problem is that if the user enters "help", and the menu item's internal name is "Help", then my program doesn't find the menu item. How can I enter "help" or any other string (lowercase and uppercase letters) and have it match with the internal name "Help"?

Matching lowercase and uppercase in c++?
use strcasecmp(char *s1, char *s2)





It returns 0 if the 2 strings are the same except for differences in case.





for example:





strcasecmp("Hello", "hELLO") returns 0
Reply:A simple way to do this is to convert all string to lower or upper case before doing any comparisons, this results in a case insensitive comparison. Most string libraries have functions o do this (I think it's tolower or toupper in C and C++).
Reply:you can use the toupper/tolower function to convert chars in uppercase/lowercase .. and then compare it.


Fun Things To Do On A Class Trip?

Ok, so just about everyone in the eighth grade is taking a trip to Washington D.C. in mid-march. So, I am going and i am staying in a hotel room with 3 of my best friends. We want to make this trip a lot of fun and very memorable. What are some fun things to do during our stay without getting in trouble. I am definetely thinking we need silly string to spray all over the hotel room, and we will be having pillow fights and jumping on and across the beds. Maybe i will even bring balloons to blow up and toss around and make our hotel room a big party room. But what else can we bring and do to make it extremely fun? Let me know of any ideas and please remember we don't want to get into a lot of trouble and we can only have one suitcase per student, so I can't take anything too big. Anyhow, thanks so much!!!

Fun Things To Do On A Class Trip?
First thing: NO SILLY STRING!


tell each girl in your hotel room to each pack one board game, facial masks, nail polish, and each something fun of their own choice to do in your hotel room. That way it's not just one of you wasting suitcase space!
Reply:I really wouldn't reccomend silly string... That gets messy and can get you in trouble. Usually you won't spend to much time in your room... Maybe bring some dvds and a portable player
Reply:Tour till you drop, take "lots" of pictures, sleep in the hotel.
Reply:i suggest bringing some Integrals


have a nice trip


:-)


Help !!! Problems with Object Orinted Programming in C++?

Im suppose to create a class to specify the data of students in a university with the following data members:





Data members Data Type


• Student name string


• Student id integer


• Fees float


• Course code integer


• IT marks float


• Mathematics Marks float


• Social Studies float





Write member functions for the following member functions for the data members


1. Initialize the values for the data members using the constructor


2. Calculate the average marks of a student


3. To register a student for a particular course. (Students must pay at least half of the specified fees in order to register for a course.)


4. To graduate from the university a student must have an average of at least 50%.


5. Print the above data members and average on the screen


The average function must be declared outside of the class.


Create an object for the students and call the appropriate member functions

Help !!! Problems with Object Orinted Programming in C++?
I got your private message notifying me of the update to your question. I'm not going to be able to effectively help you. It looks like there is a lot you don't understand about C++ and it's late in the semester so you might be out of luck. It would be better to find someone locally to help you. Here are some observations as I look at your code:





* You're not initializing the data members in the constructor.


* There's no rhyme nor reason to what is public and what is private.


* There are no member functions such as might be used to access the private data.


* The line "universityStudents::fees;" doesn't do anything and I believe it's syntactically incorrect. If the member variable fees was static, it would be referencing that member.


* You're trying to load values into member variables but you don't have an instance of the class to work with so you're going to get errors saying that the variable fees is undefined.


* The range test for fees misspells fees (i.e. "fee") and includes a dollar sign and a space in the value. Both fees and fee will be reported as undefined (the first since you have no instance of the class and the second since it's misspelled). The dollar sign and the space are going to also cause errors.


* The line "universityStudents::avg;" doesn't do anything and is probably an error.


* The attempts to load student marks into Informationtechnology, Mathematics, and Socialstudies will fail as those variables are undefined. Even if you had an instance of the class and tried to load the values using syntax like pStudent-%26gt;Mathematics it will fail because for some inexplicable reason Mathematics is a private member of the class.


* You have the avge() function defined inside main(). This might be legal in C++ but I've never tried it because it was illegal in C. Looks like you either don't have a clue or you're a former Pascal programmer. There are no local functions in C++ AFAIK.





In short, there's pretty much nothing about your code that meets the assignment (which itself is very vague and in my opinion is impossible to complete with the information you've provided).





You need to either pay closer attention in class, get some local help, or consider another major.
Reply:You should go down your own list and do it. You have it piece meal. You are not getting the students name, registering them properly if ((fee/2)==whatever), there are no methods/functions in your object....





so, do one thing at a time.


Get the students name, get the grades and print them. If you can do that, cool.


Then do the fee. Make print outs to make sure you are doing it right,





then go from there,,,,

flower garden

Help with C# end of program?

Hi I have my code but can't figure out the last part of this.


Here is my code:


using System;





public class CalculateTime


{


// Main method entry point


public static void Main()


{


//initialize variabls


int seconds = 0;





//input number of seconds


string inputSeconds;


Console.Write("Input the number of seconds: ");


inputSeconds = Console.ReadLine();


seconds = Convert.ToInt32(inputSeconds);





//call CalcMin method


CalcMin(seconds);





}





//CalcMin method


public static void CalcMin(int x)


{


int totalMinutes = 0, totalSeconds = 0;


totalMinutes = x / 60;


totalSeconds = x % 60;


//output number of minutes and seconds


Console.WriteLine("{0} minute(s), {1} second(s)", totalMinutes, totalSeconds);





}


}





the last part should be as follows:


Add a second method to the solution. This method displays a passed argument as hours, minutes and seconds. For example 3666 seconds is 1 hour, 1 minute and 6 seconds.

Help with C# end of program?
I guess I am going to do your homework for you after all.





public static void CalcHrs(int x) {


int totalMinutes = 0, int totalSeconds = 0, int totalHours = 0;





totalSeconds = x;


totalMinutes = x / 60;


totalHours = totalMinutes / 60;





totalSeconds = totalSeconds - (totalMinutes * 60);


totalMinutes = totalMinutes - (totalHours * 60);





Console.WriteLine("{0} hour(s), {1} minute(s), {2} second(s)", totalHours, totalMinutes, totalSeconds);


}


Whats wrong with the following code but it gives me the linking error in microsoft visual c++?

#define WIN32_LEAN_AND_MEAN


#include%26lt;windows.h%26gt;


LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam);


int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hprevinstance,LPSTR lpCmdLine,int nShowCmd)


{


WNDCLASSEX wc;


HWND hwnd;


MSG msg;


////////Window Class Structure


wc.cbSize=sizeof(WNDCLASSEX);


wc.style=CS_HREDRAW | CS_VREDRAW;


wc.cbClsExtra=0;


wc.cbWndExtra=0;


wc.hInstance=hinstance;


wc.hIcon=LoadIcon(NULL,IDI_APPLICATIO...


wc.hCursor=LoadCursor(NULL,IDC_ARROW)...


wc.hbrBackground=(HBRUSH)GetStockObje...


wc.lpszMenuName=NULL;


wc.lpszClassName="sono";


wc.hIconSm=LoadIcon(NULL,IDI_WINLOGO)...


wc.lpfnWndProc=WndProc;


/////////////////////


//register the class


if(!RegisterClassEx(%26amp;wc))


{


return 0;


}


hwnd=CreateWindow("sono","My APP", WS_OVERLAPPED | WS_POPUP ,100,100,250,250,NULL,NULL,hinstance,NUL...


/////////////


if(hwnd==NULL)


{


return 0;


}


ShowWindow(hwnd,nShowCmd);


UpdateWindow(hwnd);


bool done=true;


while(done)


{


PeekMessage(%26amp;msg,hwnd,0,0,PM_REMOVE)...


if(msg.message==WM_QUIT)


done=false;


else


{


TranslateMessage(%26amp;msg);


DispatchMessage(%26amp;msg);


}


}


return msg.wParam;


}


LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)


{


HDC hdc;


char string[]="Ha ha ha";


PAINTSTRUCT paint;


switch(message)


{


case WM_PAINT:


hdc=BeginPaint(hwnd,%26amp;paint);





SetTextColor(hdc,COLORREF(0x00FF0000...


TextOut(hdc,150,150,string,sizeof(st...


EndPaint(hwnd,%26amp;paint);


return 0;


break;


default:


break;


}


return DefWindowProc(hwnd,message,wparam,lparam...


}

Whats wrong with the following code but it gives me the linking error in microsoft visual c++?
A linker error isn't caused by any syntax error in your code. You're probably missing some library that you had to link to. but i've never had any problem compiling something as basic as that, so i have no idea which.





Can you put the exact linker error to clarify what is the problem?


Please help in c++ I have this code with some mistakes help i don't have time!!!?

# include %26lt; iostream%26gt;


using namespace std ;


using std :: cout;


using std :: cin;


using std :: endl;





class student{


public:


bool ok;


bool woman;


bool instudy;


int finalchoice ;


int a;


bool success;


string name ;


int grade ;


int choice[9] ;





student(){


instudy=false;


ok= false ;


success = true ;


woman = true ;


finalchoice = 0;


a=1;


}





}





int calcu(int ,int ,bool ,int , student [] );











void main (){


student students[800];


int s[]={60,80,40,40,40,60,50,80,50};


int xx[9];


int yy[9];


for(int i=0; i%26lt;800; i++){





cout%26lt;%26lt;"enter student name ";








cout%26lt;%26lt;" enter the student grade ";


cin%26gt;%26gt; students[i].grade;


cout%26lt;%26lt;" put the choices (1.......9)";


for(int j=0;j=9;j++){


cin%26gt;%26gt;students[i].choice[j];


}


}


int x=240,y=240;


for(int k=1;k%26lt;=9;k++){


int fcounter = 0; int mcounter=0;


for( int i=0;i%26lt;800; i++)


if(students[i].choice[i]-1==k)





if(students[i].woman == true ){

Please help in c++ I have this code with some mistakes help i don't have time!!!?
You could increase the chance of your question being answered by being a lot more specific about the problem.. Compile time error, run-time error..? Asking people to copy and paste and into their c++ compilers and compiling and running it is asking a bit too much... =P





so what EXACTLY is the problem?
Reply:who is even gonna look at that?? what are you , sitting in an exam room??
Reply:May be you can contact a C++ expert at websites like http://getafreelnacer.com/


C # expert Pleez help!!?

im trying to make a simple web browser could u tell me what is wrong with my code?? the line with the error is the the one that stars with Browser.Navigate(URL...etc.T











using System;


using System.Collections.Generic;


using System.ComponentModel;


using System.Data;


using System.Drawing;


using System.Text;


using System.Windows.Forms;





namespace WindowsApplication1


{


public partial class Form1 : Form


{


public Form1()


{


InitializeComponent();


}





private void GoButton_Click(object sender, EventArgs e)


{


System.Object nullObject = 0;


string str = "";


System.Object nullObjStr = str;


Cursor.Current = Cursors.WaitCursor;


Browser.Navigate(URL.Text, ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);


Cursor.Current = Cursors.Default;








}





private void URL_TextChanged(object sender, EventArgs e)


{


this.Browser.Navigate(this.URL.Text);


}





private void Form1_Load(object sender, EventArgs e)


{


this.URL.Text = "Your Favorite URL";


this.Browser.Navigate(this.URL.Text);


}


}


}

C # expert Pleez help!!?
What is the error?

edible flowers

C++ Command Interpreter?

I am wondering if this abstract base class (and supporting definitions) is sufficient enough to create a good command line interpreter:





union Result{


unsigned long lresult;


unsigned short wresult;


};





class Command{


public:


virtual Result Exec(Result [])=0;


protected:


virtual char *Syntax()=0;


virtual char *Name()=0;


private: //To Command only


Result Run(Result []);


};





Exec will run the command, which should be derived from Command.





Syntax gives a string representation of a syntax (like "llw" for a lresult, lresult, and a wresult in the array).





Name is for Run. It outputs the name by which this command should be called.





Run, only available by Command, will actually run a line of code. It is respnsible for the function of the interpreter itself, making it the "true interpreter".





Is this sufficient?

C++ Command Interpreter?
It appears complete enough. However, I would add a few methods like:


1. PreCommandHook: Allows redirection/forwarding of commands. If user wants to execute something else... Aliases could be implemented this way.


2. PostCommandHook: To allow better control for someone wanting to extend your interpreter (like updating the prompt based on result for commands like 'chdir')


3. InterruptHandler: To handle control-c by user to stop a long running command


4. ReadConfiguration: If you want to have an initialization file...
Reply:Seems like a pretty good start to me.





What about parameters that are passed? How about the environment the command runs in?


C#.NET IntelliSense?

I need to add IntelliSense(http://en.wikipedia.org/wiki/IntelliSens... functionality to a customized (SyntaxRichTextBox class that inherits the System.Windows.Forms.RichTextBox object) it handles syntax highlighting.





I am populating a list of records/fields from access database into a string array. With the following format,





F1040


F1040.TpSsn


F1040.FName


F1040.Schedule2.TpSsn


etc...





I want my IntelliSense functionality to parse this string array, and behave naturally as possilbe, in the same way that IntelliSense works with Visual Studio.NET....





Advise in process and development is appreciated as well.


Examples of code, etc...

C#.NET IntelliSense?
I could be wrong, but I don't think you can use Intellisense for what you are trying to do.





http://msdn2.microsoft.com/en-us/library...
Reply:This may help you get started:


http://www.codeproject.com/KB/cs/diy-int...


Plzzzzzzzzzzzzzzzzzzz help in programming plzzzzzzzzzzzzz?

I write a program with class for a student and add a overloading operator= but i have many error in it plzzzzzzzzzzz


help





#ifndef STRING1_H


#define STRING1_H


#include %26lt;iostream.h%26gt;


class String{


public:


String %26amp;operator=(const String %26amp;);//assign array


private:


char * s;};


#endif








#include%26lt;iostream.h%26gt;


#include%26lt;iomanip.h%26gt;


#include%26lt;stdlib.h%26gt;


#include%26lt;assert.h%26gt;


#include%26lt;string1.h%26gt;


#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;string.h%26gt;


String %26amp;String::operator=(const String %26amp; str){


strcpy(string,str.string);


return *this;


}


#include"string1.h"


#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;string.h%26gt;


#include%26lt;stdlib.h%26gt;


#include%26lt;iostream.h%26gt;


class student{


char id[13];


char id1[13];


//int min ;


//int hour;


// char ch;


char time1[7];


char time[7];





//char time[7];


char name[30];


char name1[30];


char address[50];


char address1[50];


char date[13];


char date1[13];





int h;


public:


student();


void ID();


void NAME();


void Address();


void Time();


void Date();


void change();


void print();








}t;


student::student(){





id1[0]='8';


id1[1]='4';


id1[2]='4';


id1[3]='4';


id1[4]='1';


id1[5]='1';


id1[6]='0';


id1[7]='0';


id1[8]='1';


id1[9]='0';


id1[10]='5';





address1[0]='d';


address1[1]='u';


address1[2]='b';


address1[3]='a';


address1[4]='i';





name1[0]='m';


name1[1]='a';


name1[2]='h';


name1[3]='y';


name1[4]='a';





time1[0]='1';


time1[1]='0';


time1[2]=':';


time1[3]='3';


time1[4]='4';





date1[0]='1';


date1[1]='9';


date1[2]='9';


date1[3]='8';


date1[4]='/';


date1[5]='1';


date1[6]='0';


date1[7]='/';


date1[8]='1';


date1[9]='2';


// f[0]='j';


// f[1]='o';


//f=new char[4];





}





void student::ID(){


int c=0;


for(int i=0;i%26lt;11;i++){





if(id1[i]-48%26lt;10%26amp;%26amp;id1[i]-48%26gt;-1 )


c++;


}


if(c==11){


for(int k=0;id1[k];k++)


id[k]=id1[k];


cout%26lt;%26lt;"ID:"%26lt;%26lt;id%26lt;%26lt;endl;}





else


cout%26lt;%26lt;"you enter wrong number"%26lt;%26lt;endl;





}











void student::NAME(){


int c=0;


for(int i=0;name1[i];i++){


if((name1[i]%26gt;='a'%26amp;%26amp;name1[i]%26lt;='z')||... ' )


c++;}





if(name1[c]=='\0'){


for(int k=0;name1[k];k++)


name[k]=name1[k];


cout%26lt;%26lt;"NAME:"%26lt;%26lt;name%26lt;%26lt;endl; }


else


cout%26lt;%26lt;"you enter wrong name"%26lt;%26lt;endl;


}








void student::Address(){


int c=0;


for(int i=0;address1[i];i++){


if((address1[i]%26gt;='a'%26amp;%26amp;address1[i]%26lt;=... ' )


c++;}





if(address1[c]=='\0'){


strcpy(address,address1);


cout%26lt;%26lt;"Address:"%26lt;%26lt;address%26lt;%26lt;endl; }


else


cout%26lt;%26lt;"you enter wrong number"%26lt;%26lt;endl;


}








void student::Time(){


int c=0;


int i=0,j=0,m;


for(;time1[i];i++){


if(time1[i]==':'){


c++;j=i; }}


if(c==1%26amp;%26amp;j%26gt;0){


if(j==1)


h=time1[0]-48;


else if(j==2)


h=(time1[0]-48)*10+(time1[1]-48);








if(i-j-1==1)


m=time1[j+1]-48;


else if(i-j-1==2)


m=(time1[j+1]-48)*10+(time1[j+2]-...


}


else


cout%26lt;%26lt;"you write wrong time"%26lt;%26lt;endl;





if(h%26lt;25%26amp;%26amp;h%26gt;0%26amp;%26amp;m%26lt;60%26amp;%26amp;m%26gt;-1){





strcpy(time,time1);


cout%26lt;%26lt;"Time: "%26lt;%26lt;time;


if(h%26lt;12)


cout%26lt;%26lt;" AM"%26lt;%26lt;endl;


else


cout%26lt;%26lt;" PM"%26lt;%26lt;endl;


}





else


cout%26lt;%26lt;"you write wrong time"%26lt;%26lt;endl;


}





void student::Date(){


int M=0,Y=0,D=0,i,j,c=1,c1=1,c2=1;


for( i=0;date1[i];i++)


j=i;


while(j%26gt;=0){





if(date1[j]=='/'){


if(j!=4%26amp;%26amp;j!=7%26amp;%26amp;j!=6){


cout%26lt;%26lt; "you enter wrong year";


break;}


j--;}


if (date1[j]-48%26gt;-1%26amp;%26amp;date1[j]-48%26lt;10%26amp;%26amp;(date1[...


M=(date1[j]-48)*c1+M;


c1*=10;


}


else if (date1[j]-48%26gt;-1%26amp;%26amp;date1[j]-48%26lt;10%26amp;%26amp;(date1[...


Y=(date1[j]-48)*c2+Y;


c2*=10;


}


else if(date1[j]-48%26gt;-1%26amp;%26amp;date1[j]-48%26lt;10){





D=(date1[j]-48)*c+D;


c*=10;


}


else


break;





j--;


}


if(D%26gt;0%26amp;%26amp;D%26lt;31%26amp;%26amp;M%26gt;0%26amp;%26amp;M%26lt;7%26amp;%26amp;Y%26gt;1880%26amp;%26amp;Y%26lt;...


strcpy(date,date1);


cout%26lt;%26lt;"DATE:"%26lt;%26lt;date;}


else if(D%26gt;0%26amp;%26amp;D%26lt;32%26amp;%26amp;M%26gt;6%26amp;%26amp;M%26lt;13%26amp;%26amp;Y%26gt;1880%26amp;%26amp;Y%26lt;2008)...


strcpy(date,date1);


cout%26lt;%26lt;"DATE:"%26lt;%26lt;date;}





else


cout%26lt;%26lt;"you enter wrong DATE";





}





void student::change(){


int I,i=0;//h,m;


cin%26gt;%26gt;I;


switch(I){


case 1:


gets(id1);


ID();


break;


case 2: gets(name1);


NAME();


break;


case 3:gets(address1);


Address();


break;


case 4:


gets(time1);


Time();


break;


case 5: gets(date1);


Date();


break;


default: exit(0);


}


}











void student::print(){


cout%26lt;%26lt;"ID:"%26lt;%26lt;id%26lt;%26lt;endl;


cout%26lt;%26lt;"NAME:"%26lt;%26lt;name%26lt;%26lt;endl;


cout%26lt;%26lt;"Address:"%26lt;%26lt;address%26lt;%26lt;endl;


cout%26lt;%26lt;"Time: "%26lt;%26lt;time;


if(h%26lt;12)


cout%26lt;%26lt;" AM";


else


cout%26lt;%26lt;" PM";


cout%26lt;%26lt;endl%26lt;%26lt;"Date:"%26lt;%26lt;date;


}




















main(){


clrscr();


t.ID();


t.NAME();


t.Address();


t.Time( );


t.Date();


char s1("happy"),s2;


cout%26lt;%26lt;"assigment";


s2=s1;





cout%26lt;%26lt;"s1"%26lt;%26lt;s1;


cout%26lt;%26lt;"s2"%26lt;%26lt;s2;





/* cout%26lt;%26lt;endl%26lt;%26lt;"preess 0 to change"%26lt;%26lt;endl%26lt;%26lt;"press any key for exit";


int j=-1;


cin%26gt;%26gt;j;


while(j==0){











if(j==0){


cout%26lt;%26lt;"1.id 2.name 3.address 4.time 5.Date";


t.change();


}


getch();


clrscr();


t.print();


cout%26lt;%26lt;endl%26lt;%26lt;"preess 0 to change"%26lt;%26lt;endl%26lt;%26lt;"press any key for exit";;


cin%26gt;%26gt;j;


} */











}

Plzzzzzzzzzzzzzzzzzzz help in programming plzzzzzzzzzzzzz?
How does this even compile:





String %26amp;String::operator=(const String %26amp; str){


strcpy(string,str.string);


return *this;


}





what is string? You don't have that declared anywhere.
Reply:did this work at some point?
Reply:Yes, it may have an error in it.
Reply:i'm not gonna simulate this program.report abuse if you like.


In C++, What is the use of using std::ios? What will it do in the program?

I also want to know the use of


using std::setiosflags


and


using std::fixed


Can u give examples for all


Explain pointers in simple and complete way...


Can u explain how to use strings...especially when the


program is in class format?


Thanks

In C++, What is the use of using std::ios? What will it do in the program?
Please do your school questions alone otherwise you will not learn. I am sure that your C++ book explains all these if only you did care to read it.
Reply:.... "and then, could you write a research paper for me on the rise of computing in the 20th century. Also, explain, in mind-boggling detail, the entire concept of object oriented programming. Can u give an exhaustive explanation of all the different data types, as well as complete programs that use them....."


Ok - I'm on it!
Reply:Even worse Old Programmers like me will never hire you.

covent garden

Can anyone help me with this C++ program?

It is suggested that you try to practice the class we have learned so far. If you don’t use a class, even your program runs fine, you won’t get all points.





SPECIFICATION:





Write a program to do the following:





1. Input a series of strings into an array. Let the user specify how many strings are to be input.





2. 2. Write a function to return the number of vowels in a string





3. 3. Output each word of a string on a separate line. Assume that the words are separated by a single blank with a period at the end of the string.





The program reads from the terminal and prints the result to the file "prog1.out".

Can anyone help me with this C++ program?
try it its easy
Reply:I need a day to solve it becauseI have to install TC++
Reply:Or else you may want to contact a C++ expert to help you code your homework. Check websites like http://askexpert.info/


Pass by reference functions in C++?

write a pass by reference functions for 3 courses u take


the course name (without spaces)


number of creds


grade value (decimal number)





so far i got the value ret function right but im stuck my code so far is





#include %26lt;iostream%26gt;


#include %26lt;iomanip%26gt;


#include %26lt;string%26gt;


using namespace std;


//fn prototype for passing num of students in class


void DisplayStudent(double num, double answer);


void DisplayName(coursename%26amp;);














int main ()


{


double num,answer;


cout%26lt;%26lt;"Enter the total number of students in each class \n";


cin%26gt;%26gt;num;


answer=num;


cout%26lt;%26lt;"What course you want to take\n":


cin%26gt;%26gt;name;


//function call


DisplayStudent(answer,num);


DisplayName(coursename%26amp;)


return 0;


}


//function goes here


void DisplayStudent(double num,double answer)


{


cout%26lt;%26lt;" the total number of students="%26lt;%26lt;answer;


}


voidDisplayName(coursename%26amp;)


{ cout%26lt;%26lt;"what course"%26lt;%26lt;answer;


cin%26gt;%26gt;course;


}





if u can help much appreciated !!!!!!!!!!

Pass by reference functions in C++?
This should be your function prototype:





void DisplayName( string %26amp;courseName );





Keep at it!
Reply:#include %26lt;iostream%26gt;





using namespace std;





int calculateGPA(double, double);





void main ()


{





char[] course;


double totalCredits = 0.0;


double totalPoints = 0.0;


double hours, grade;


int continue = 1;





//1 equates to true in C or C++, 0 equates to false


while(continue)


{


cout%26lt;%26lt;"Enter class: ";


cin%26gt;%26gt;course;


cout%26lt;%26lt;"\nEnter credit hours: ";


cin%26gt;%26gt;(double)hours;


cout%26lt;%26lt;"\nEnter course grade: ";


cin%26gt;%26gt;(double)grade;





//add to total credits for GPA calculation


totalCredits += hours;


//this is tricky, I know this calculation because Im a student


//you should know this to from report cards


totalPoints += (grade * hours);





cout%26lt;%26lt;"\nEnter 1 to add another class or 0 to quit";


cin%26gt;%26gt;(int)continue;





}//end while





//once user quits entering info, calculate statistics


cout %26lt;%26lt; "GPA = " %26lt;%26lt; calculateGPA(totalPoints, totalCredits);





}//end main








int calculateGPA(totalPoints, totalCredits)


{


return (int)(totalPoints/totalCredits);


}

email cards

C++ vector help please?

i'm pretty sure it's simple but i was not in class for 3 days due to an early spring break. i got sent the stuff we did so i need to write the program of the executable file








i'm a little confused as to how to do vectors..like...let's say for vector 1. it's an int vector or whatever...so...the exectuable file asks what size u want it to be. and what the filler value will be. so far....at the top i have








int a;


int b;


vector%26lt;int%26gt;one(a,b);


cin%26gt;%26gt;a;


cin%26gt;%26gt;b;








is that the correct way to do it??








and also. for let's say for vector 2, it's a string vector..idk how u would get the user to enter in something?








so far i have








string a;


string b;


vector%26lt;string%26gt;two(a,b);


cout%26lt;%26lt;"What will be the size of vector 2? ";


getline(cin,a);


cout%26lt;%26lt;"What will be the filler value for vector 2? ";


getline(cin,b);











but i know that's not right...could someone help me correct it. and also how do u get the vectors to print?

C++ vector help please?
So, it helps to think out what you are doing rather than guessing with code.





int a;


int b;


// Ok so you have two integers.


vector%26lt;int%26gt;one(a,b);


// So, now you create a vector. Wait a minute, what is a and b though?


cin%26gt;%26gt;a;


cin%26gt;%26gt;b;


// So you create a vector with a and b first, and *then* you take inputs for a and b? Huh? Shouldn't you be inputting the values of a and b first?





Same thing in your second example. You create the vector first, and then ask for inputs? Hey, it's top down. Line 1 comes first, line 2 comes next, line 3 comes after that. If you have code to create a vector, and you have it on an earlier line, guess what happens...
Reply:Okay, so I am assuming that your vector is just an abstract datastructure for making a fancy array.





The way you use the vector datastructure is like this:





vector%26lt;type%26gt;name(length, preset value);





So you need to declare your a and b values before you call the structure. Right now you are declaring vectors of undefined length a with a default value of undefined b. Those values are whatever they were the last time that piece of memory was used. So basically they are full of bad data.





If you want to dynamically allocate memory, you need to use malloc or calloc. But in C++ you can just use "new."





So you could type:





int a = 0;


int *array;





cout%26lt;%26lt;"How long do you want your int array to be? ";


cin%26gt;%26gt;a;


array = new a*(sizeof int);





But when you use new you have to do a delete later.





fortunately, C++ keeps track of the length, so you can just do





delete [] array; after you are done with the array to clean up in the end.


How do i remove an element in a c++ array when the array is predetermined?

//say i have a class called Employeetype





//my Employeetype contains an int id, float salary, string last_name, string first_name





Employeetype employee;





employee[30];





//i read the employees in from a file and i have one i would like to remove. i have to remove that employee then shift all the employees down to fill in that space.





//srry im a beginner and need help i need the most simple way possible








//thnx guys

How do i remove an element in a c++ array when the array is predetermined?
You will have to set the element in the array to null, then loop through the rest of the array, moving each up (loop element - 1) until you reach the end of the array.





I have included a link to a site which shows you some great basic array manipulation. Scroll down to the section titled "Inserting" and you will find some code that shows you the moving up of items after an insert. The same thing will apply when you remove an item. Everything below the delete will then move up to take the space of the deleted item.





Just remember that after all items are moved up that the last item is set to null so that you won't have to items that are the same and you have a null that can terminate a loop through the array.





Check out the link and I hope it helps! Good luck!


In programming (C#), why are some methods invoked different ways than others?

Example:


To invoke an array sort method, it is written


Class.Method(Instance);


or


Array.Sort(array1);





But to invoke a string split method, it is written


Instance.Method();


or


string1.Split(' ');





Why are they different and what is the key deciding factor that differentiates between the two? In other words, how will I know to write it one way or the other while coding other than trial and error?





Thanks!

In programming (C#), why are some methods invoked different ways than others?
I'm not sure about C#, but it's very similar to Java. So, they SHOULD work the same way.





//When you declare a static method, you will need to do it this way. The method will not refer to any instance variable.


//In this example, you are calling the Array class to sort array1. The Sort method dont need to refer to any instance variable to sort the array. It can just read the elements and sort it up and then return the result back to you.


Class.Method(Instance);


or


Array.Sort(array1);





//This is a non-static method. So the method is dependent on the instance variable.


//Like for this example, you are splitting the string1 variable itself.


But to invoke a string split method, it is written


Instance.Method();


or


string1.Split(' ');





You just need to understand the concept of static vs non-static methods. Do you think an Add() method needs to be static or not? Does the Add() method need to refer to any instance variable? No! All it needs is numerical values to be passed in the method then it'll just add them up and return the result. No reference to an instance variable needed.





Hope that'll help you understand the difference.
Reply:These methods are called differently because of the way they are declared in the class. Array.Sort is a static method, whereas string1.Split is a regular method. Static methods belong to the class, and are not dependent on any instance of the object to function (unless they take an instance of the object as a parameter). In other words, Array.Sort can be called even if you have not created any Array objects. Of course, if you have no Array objects to be sorted, how can you call Array.Sort when it takes an Array object as a parameter? (You can't, but the point is its AVAILABLE to be called)





So, why are some methods static (Array.Sort) and other methods are regular (string1.Split)? It's mainly a matter of practicality. Only one copy of a static method is used, no matter how many objects exist, while a copy of a regular method is created each time an object is instantiated. This can reduce the size of the compiled program dramatically, especially if there are arrays of objects. For example, consider a two-dimensional array: an Array object whose elements are all Array objects. Another reason to use static methods is style/code organization. Look at the Math class. Its a way to group all those functions together, even though you never create a Math object (infact, you cannot create a Math object).





As for knowing how to use all these methods, it is somewhat frustrating at first. You will quickly learn the commonly-used classes just from routine use; Intellisense helps me tremendously with this. I'm certain I will never know ALL of the .Net classes. I know the classes I use frequently, and when I need to use a class I'm not familiar with, I simply look it up in Visual Studio help, or go to msdn.





Hope this has been helpful, and hang in there, you'll spend less time on msdn looking up classes as you do more programming.


C# datagrid, list, array....Plz! it's urgent?

i need to create a list, or a datagrid to view in each row the following: a string, a random sequence of numbers that relate to that string in a way, a real number that is the result of using each random number as it appears... i've performed all the above but i displayed it using labels, which is impractical specially that i have to display 500 rows!


now i need may be to create a class with the features above, then create an array of this class containing 500 element, each is an instance of that class.


The problem is; i don't know how to create an array nor a list, i don't know how to bind data to a datagrid, no database is needed.





plz can u help me with this. it is so urgent...

C# datagrid, list, array....Plz! it's urgent?
in System.Collection there is a class called ArrayList that has really easy add/delete methods.





ArrayList al = new ArrayList();





al.Add(object o);





o can be any kind of class.





and retrieving (data type) al[i];





Data type is the actual type of the object you added before hand.

cheap flowers