zeroliken 79 Nearly a Posting Virtuoso

Maybe it would have been better if there was a separate poll with OS and IDE or compiler because of the poll limiter :)

zeroliken 79 Nearly a Posting Virtuoso

Well I learned Java with javac command prompt which gave me a basic idea of how java works
When I moved on to netbeans(IDE) I felt more relaxed as it made coding easier as it provided suggestion, corrections, shortcuts etc.

I suggest that beginners should learn java with simple command prompt applications

zeroliken 79 Nearly a Posting Virtuoso

This is the community Introduction forum

Post your thread in this forum
Windows Vista and Windows 7

zeroliken 79 Nearly a Posting Virtuoso

It is useful for me, if you write me, code in C++ for this task, and I translate in assembly... Please help me if you know, it is very important

People here will give you suggestions to help you but I don't think that anyone will do the work for you

zeroliken 79 Nearly a Posting Virtuoso

Create a program that displays the numbers that divide evenly into all the numbers from a given starting and ending number by the user. Class name is Divisibility

Sample output

Starting number:1
Ending number: 1

1 is divisible by 1
2 is divisible by 1 2
3 is divisible by 1 3
.
.
.
.
.
77 is divisible by 1 7 11
78 is divisible by 1 2 3 6 13 26 39
.
.
.
.
100 is divisible by 1 2 4 5 10 20 25 50

Enter another number or 'no' to exit the program: no

Read the rule's before posting
Member rules
Create you own thread
No one's gonna do all the work for you, post your code to show your effort and we'll help if you have problems with it

zeroliken 79 Nearly a Posting Virtuoso

I still cant say. :) More likely some applications that will work with internet and may connect computers. I still dont know but one thing i can say for sure that it will work with internet(chat clients, maybe online games(not complicated)).

BTW your link helped me a lot and i am now thinking about Java.

Good Luck Then ;)

zeroliken 79 Nearly a Posting Virtuoso

No, i don't want to make games. It was just easiest thing for noobs.

What applications do you want to make?

Did you check the link I posted It might help you clarify some things between c and c++

Edit: sorry just saw your edit of your previous post

I want to make programs connected with internet.

what kind of program? its purpose? :)

zeroliken 79 Nearly a Posting Virtuoso

Here's a link to a read me thread in the Computer Science forum
Programming FAQ

There's topic there concerning c and c++

(i can make some basic games and programs, like snake game)

For basic console games I suggest c
Though if you want to create complicated games(3d) I suggest c++

zeroliken 79 Nearly a Posting Virtuoso

Why do you need array "n" in the first place?

Can't you assign numbers to the 2d array without it

zeroliken 79 Nearly a Posting Virtuoso

If you don't have a textbook there's always Google Search
Here's a few search results
C File I/O Tutorial
File Handling in C

zeroliken 79 Nearly a Posting Virtuoso

@ lines 29 and 86 you check if the first input is hexadecimal... you should check the value of the second input
use str2 instead of str

I'm sorry its not in English and if this bothers anyone I can translate the code into english

If you still have problem with the program I'd appreciate that or you can use comments in English on the important parts of the code

zeroliken 79 Nearly a Posting Virtuoso
if(timesshot != 45);
{
//...
}else{ 
     if(timesshot == 45);
     {
     //...
     }
}

try to remove the semicolons in your if statements

Now why make an "if(timesshot == 45)" statement when you already have an else statement (@ the "if(timesshot != 45)" statement) for that very purpose?

zeroliken 79 Nearly a Posting Virtuoso
typedef struct{ //there is no space in typedef
     char name[66]l
     int no;
}re;

main(){  //I suggest you use int main 
//rest of your code here

}

Don't declare the structure inside the main function declare it outside and above from the main

can[0].name="xx";
can[1].name="yy";

you cannot simply assign one array to another. You have to copy it element by element.
use strcpy() for assigning a value "If your not familiar with it you can search google"

Don't forget to include this header

#include<string.h>
zeroliken 79 Nearly a Posting Virtuoso

Do you mean that you want to remove all of the values in the linklist?

you can use the remove() on all the indexes

zeroliken 79 Nearly a Posting Virtuoso

to change JButton size:
ButtonName.setPreferredSize(new Dimension(buttonWidth, buttonHeight));

zeroliken 79 Nearly a Posting Virtuoso
#include <iostream> //#include <stdio.h>
#include <string>
using namespace std;
int main (void)
{
using std::string;
string letter;

cout << "Enter a letter: "; //use printf() instead of cout
cin >> letter;              //use scanf() instead of cin

if (letter == "a")
{
cout << "aqua" << endl;
}
		
if (letter == "b")
{
cout << "blue" << endl;
}

return 0;
}

It's your job to convert your program to c
search the web on examples of c programs

zeroliken 79 Nearly a Posting Virtuoso

here's a link for Nested Loops and for arrays
You'll be surprised that you can learn a lot more when you search the net

am really getting problem

If you have problem in the code you can post it here so we can help

zeroliken 79 Nearly a Posting Virtuoso

i want to create shapes like circles,rectangles and others with the help of c language programming.basically i want to make the sign of matrix in my program.how can i do this?

Please be clear in describing
as rubberman said,
Do want to create/show shapes graphically?
Try using Forger's

the sign of matrix

Do you mean the movie? Please clarify this

If this is true then, like adityatandon said, there is no need to make shapes
Just use an almost infinite loop in displaying 0's and 1's at the console

zeroliken 79 Nearly a Posting Virtuoso

Actually, should be void randomize (int* array, int arraySize)... :-) Thanks. Keyboard keeps changing what I am typing!

void randomize(...), maybe you meant void randomizeArray(...) as to be consistent with the code you posted

Sorry just nitpicking here :)

zeroliken 79 Nearly a Posting Virtuoso

void randomizeArray(int array*, int arraySize) //should be *array
just correcting trivial details :)

zeroliken 79 Nearly a Posting Virtuoso

Happy New Year 2012 from Continental Europe

thread title doesn't connect with the description
I could downvote this thread for breaking a rule on using clear and relevant titles for new threads :twisted: but I don't feel like it ;)

Anyway have a prosperous new year mKorbel
;););)

zeroliken 79 Nearly a Posting Virtuoso

For accepting a String :
Cin works for accepting strings till a space is discovered.
Instead of using cin.getline you can also use the gets() [available under string.h] function which accepts a string. It stands for 'get string'!!

To Find Length of String :
Two ways :
1) Use strlen() - stands for string length (Found under string.h)
2) Run a for or a while loop checking every element encountering '\0' as all strings are terminated by that. Also make sure to keep incrementing a variable by 1, so when u find '\0' you can break from the loop and the variable who were incrementing has the length of the string !

If you look at the date of post,this thread was created in 2007
Let it rest in peace

zeroliken 79 Nearly a Posting Virtuoso

“For last year's words belong to last year's language and next year's words await another voice.”

-T.S. Eliot

zeroliken 79 Nearly a Posting Virtuoso

Ummm.. why is void main() wrong ? U can always use void main, it just indicates main isnt returning anything! Drawbacks, if any, please do list out, even I'd like to know..

As mentioned above, sort the array using the first alphabet of every string...
eg : compare passengerName[1][0],passengerName[2][0] etc to get a sorted list...
If the first elements are the same in a case, sort the second element! Thus u can arrange them alphabetically !

read this thread
int main vs. void main
Also search for google for more info

zeroliken 79 Nearly a Posting Virtuoso

cout<<i<<" + "<< n-i<<" = "<<n;

This is the C forum not C++

Translation:

printf("%d + %d = %d",i,(n-i),n);

also don't do the OP's work for him... it's not your homework
let him learn by himself, we're only here to guide/teach him

zeroliken 79 Nearly a Posting Virtuoso

@HacruLeian

please read the rules before posting

You should have started your own thread instead of hijacking this thread
How would you feel if suddenly someone else posted a new question in your thread which made users ignore your own question

I Hope that a mod will move the previous posts....

zeroliken 79 Nearly a Posting Virtuoso

It's a lot better to ask the teacher who gave you the assignment for clarifications

Are you suppose to generate a flow chart from your code?
try AutoFlowchart

Are you suppose to create/show a flow chart from your code?
try using Forger's to create a window that will graphically show the user the program

or maybe the teacher is simply implying to make the program work based on your flowchart or display the program in a flowchart like manner ;)

Of course most of these suggestion's are not beginner friendly so please ask your teacher first and come back here if you need help :)

zeroliken 79 Nearly a Posting Virtuoso

Make a String Tokenizer program and set the delimiters to characters other than the alphabets

zeroliken 79 Nearly a Posting Virtuoso

use .equals when comparing Strings instead of ==

though I think it would have been more appropriate if the data type of choice is an int rather than a String

zeroliken 79 Nearly a Posting Virtuoso

I Think Net Bean is great other than notepad it also allows you to compile,debug and run you code with few clicks.

Don'y reply from a thread created in 2003!

zeroliken 79 Nearly a Posting Virtuoso
System.out.println("Enter SSN: ");
SSN[i] = s.nextInt();
System.out.println("Enter Last Name: ");
Lname[i] = s.nextLine();

Enter Last Name: <--- JUMPED!

when you inputted the number, you’re unintentionally leaving a trailing a newline behind. The newline you left there is then captured instantly upon reaching the next s.nextLine()
read here for more info:
input skipping in java

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at SalariedEmployee.Search(Menu.java:46)
at Menu.main(Menu.java:121)

At the search method line 32-37

n=99;
// ...
for (int i=n-100; i<n; i++) { // you initialized that i = -1

It's pretty obvious what happened here

zeroliken 79 Nearly a Posting Virtuoso

Ok i have done finding how many times does a particular question is being missed by the students.Now the problem i m facing is that i know how to sort the results but i dont know how to show the results with their ids or students number. e.g student #2 is #1 in the class and so on in descending order. i would highly appreciate if u could plz clarify it with the help of code.

Could you post your current code it's hard to guess if I don't know what you did so I'll just post a guide

int total=0; //starting student in the arraylist
while (total<=100){ //number of students
      if(student[total]<student[total+1]) //if current value(student score) is less than the next value
{
 //code here that will exchange values of current array index with its next
total = 0; //start again
}
total++; // increment to next index
}
zeroliken 79 Nearly a Posting Virtuoso

NO!!! He must define playAgian() function before main()!!!

Why didn't you mention this in your first post, rather you just posted your code without bothering to explain what you did or explain how your code will help?

zeroliken 79 Nearly a Posting Virtuoso

:sad:

  1. You did not bother wrapping the code in [code] tags
  2. did not properly explain your code
  3. Worst of all the code is not even a proper solution

    bool playAgian(){
        using std::cout; 
        using std::cin;
        bool playAgian;
    
        cout << "You scored points. Would you like to play agian? \n"
        << "[1] yes\n"
        << "[2] no\n";
        cin >> playAgian;
        return true;  // :(
    }
    

The function shouldn't always return true... what's the purpose of asking :?:

zeroliken 79 Nearly a Posting Virtuoso

Could you post your code so we can see how you implemented your formula

zeroliken 79 Nearly a Posting Virtuoso

well <iostream.h> and <conio.h> are old and deprecated libraries
It's better when you use a modern library like <iostream>

also since you didn't bother to wrap the code in code tags it's hard to tell if you did a good job

zeroliken 79 Nearly a Posting Virtuoso

would you feel better if you don't use them...
like just use next() in lines 17, 39, 48

puppycrazy commented: thx so much~problem sloved ad! +0
zeroliken 79 Nearly a Posting Virtuoso

Line 49 works fine without the ...Line() if you're using Strings

That's nextLine(), not Line().

Would he really just use Line() :) ;)

zeroliken 79 Nearly a Posting Virtuoso

Good advice, yes, but in this case the code is comparing chars, not Strings

char oo = xx.next().charAt(0);
if (oo == 'y')...{

so .equals cannot be used in this situation.


Maybe the problem here is that the y/n is read with a next(), which will leave a newline character unprocessed in the scanner's buffer, so the student name's nextLine() returns the remainder of the current line, ie "".
At line 49 try a nextLine() rather then a next() to read the y/n so that the newline character is processed normally.

Yes... sorry about that just noticed that char was used instead of string so the next step would have been my previous post... :$

It's correct but unnecessary... my bad

zeroliken 79 Nearly a Posting Virtuoso

change oo and s to string and use nextLine() for receiving input
e.g

String oo = xx.nextLine();

also just noticed now that the program continues when vv is equal to false and when you choose n the program continues to run cause it remains to be false

zeroliken 79 Nearly a Posting Virtuoso

use .equals() when comparing strings rather than ==
try to read this link for more info
Java: ==,.equals()

zeroliken 79 Nearly a Posting Virtuoso

thanks for your response but i have to work with all these stupid and old things that is what my assignment needs. graphics.h and the window function is working properly in all other programs and other functions but is doing problem in given piece of code.:S

Sad to say that's as much help as I can give
I have no experience using that library and my IDE can't use graphics.h anymore so I can't give a better response
try to compare this code with your other programs and carefully check each details or maybe hope that veteran users might give a response to this thread

good luck :cool:

zeroliken 79 Nearly a Posting Virtuoso

It would be a lot easier if the code is wrapped in code tags :(

return playAgian;

If the function is a Boolean try to return either true or false

zeroliken 79 Nearly a Posting Virtuoso

I have understood the logic behind this, but i am facing problem with the coding thing.. i am not able to get it properly..

If the problem is in the code then post the code so we may help

zeroliken 79 Nearly a Posting Virtuoso

guys and girls,I need you to explain to me some things! I dont know anything for the above languages and google doesn't help much. What do you believe for html5?

sorry if I am asking for a lot.I need help

There's always Google to help you out on the search for a programming language that suits you and here's a few definition for them that I found... note that these are not as is.

C is a structured, procedural programming language that has been widely used both for operating systems and applications and that has had a wide following in the academic community. Many versions of UNIX-based operating systems are written in C. C has been standardized as part of the Portable Operating System Interface (POSIX).

With the increasing popularity of object-oriented programming, C is being rapidly replaced as "the" programming language by C++, a superset of the C language that uses an entirely different set of programming concepts, and by Java, a language similar to but simpler than C++, that was designed for use in distributed networks.

zeroliken 79 Nearly a Posting Virtuoso

graphics.h was a library in the 16 bit world where it is used for doing graphics in DOS with Borland C++ 3.x
(In short it is an old & unsupported library nowadays )

...maybe that's where your problem starts

try using Forger's for making a window

zeroliken 79 Nearly a Posting Virtuoso

There are lot's of exercises in the web if you search right
try this it has an exercise included in every chapter
Introduction to Programming Using Java Version 3.0, Summer 2000

zeroliken 79 Nearly a Posting Virtuoso

Thank you for your answer. I had read the international code in the previous two links. These do not solve the problem. I submit my JAVA code, so please if any one can update it and return the solution? That is exactly what I need.
Thanks to all
Sherif

post your current code so we can see how you tried to convert the characters

zeroliken 79 Nearly a Posting Virtuoso

try to add continue and see if it works you... though I think its suppose function normally without it

for(ctr=0;ctr<10;ctr++)
{
cout<<"enter the salary:";
cin>>salary[ctr];
if(salary[ctr] == 0)
{
cout<<"salary should be greater than zero"<<endl;
cin>>salary[ctr];
continue;
}
zeroliken 79 Nearly a Posting Virtuoso

but if i do that wont the user have to input the whole values again ?

using continue does exactly the same thing

do you just want the salary to have a value not equal to 0?
then why not change the current value(0) to give way to a new value

for(ctr=0;ctr<10;ctr++)
{
cout<<"enter the salary:";
cin>>salary[ctr];
if(salary[ctr] == 0)
{
cout<<"salary should be greater than zero"<<endl;
cin>>salary[ctr];
}