Search:

Type: Posts; User: Adrian

Search: Search took 0.01 seconds.

  1. Thread: Compiler Issues

    by Adrian
    Replies
    10
    Views
    1,515

    After compiling main.c on the command line in...

    After compiling main.c on the command line in command prompt everything is fine. Then I type in main.c and the program opens up in Notepad.

    Edit: Probably because I'm putting in the .c at the...
  2. Thread: Compiler Issues

    by Adrian
    Replies
    10
    Views
    1,515

    I chose notepad to be the program to open it up...

    I chose notepad to be the program to open it up with and now whenever I run the program from the command line (it compiles without problems now) my program code will just open up in notepad. How...
  3. Thread: Compiler Issues

    by Adrian
    Replies
    10
    Views
    1,515

    Ahh, that would make sense, I moved it to a...

    Ahh, that would make sense, I moved it to a folder in my documents, now I get that Windows cannot open the file main.c (but I have permission at least) and it wants to know what program I want to use...
  4. Thread: Compiler Issues

    by Adrian
    Replies
    10
    Views
    1,515

    Compiler Issues

    I am running Windows Vista Home Premium and have not been able to get MinGW working with command prompt yet. I think I am pretty close though. Currently when I make a simple C program to run and...
  5. Replies
    1
    Views
    1,140

    Simple Function Pointers - Determining Output

    Trace the following program to determine its output.


    #include <iostream>
    using namespace std;

    void foo (int *a, int *b)
    {
    *a = *a + *b;
    *b = *b + 2;
  6. Replies
    5
    Views
    2,388

    Alright, a 2d array would make sense, thanks a...

    Alright, a 2d array would make sense, thanks a lot.
  7. Replies
    5
    Views
    2,388

    Alright, that's what I was expecting to do. How...

    Alright, that's what I was expecting to do. How would I get each line of text into an area where I can use the bubblesort process on them? I know each character is being read, but I'm not sure how...
  8. Replies
    5
    Views
    2,388

    Alphabetizing Lines of Text

    I am supposed to take the contents of 1 text document and output it into another by have the lines alphabetized.

    Your program should:
    – open the file input.txt
    – read all the lines in input.txt...
  9. Replies
    7
    Views
    4,207

    This is what it should be: int isPrime (...

    This is what it should be:



    int isPrime ( int number )
    {

    int x = 1;

    int i = 2;
  10. Replies
    7
    Views
    4,207

    int isPrime ( int number ) { int x; int...

    int isPrime ( int number )
    {

    int x;

    int i = 2;

    for(i=2; i<number ; i++)
    {
    if((number&#37;i) == 0)
  11. Replies
    7
    Views
    4,207

    Function to Determine if Int is Prime

    I am supposed to write a function that determines if a number is prime or not. I return 1 if it is prime and 0 if it is not.

    This is what I have so far:



    int isPrime ( int number )
    {
    int...
  12. Replies
    11
    Views
    1,350

    Somehow I have to ignore the '-' and do the same...

    Somehow I have to ignore the '-' and do the same process but multiply it by -1 at the end. I think I can do this.

    Edit: I got it, thanks again for your help.
  13. Replies
    11
    Views
    1,350

    Actually, it gives me 0 for negative numbers...

    Actually, it gives me 0 for negative numbers because I'm returning 0 (since value = 0 before the for loop, which won't run if they have a '-' at the beginning of the string). How would I get the...
  14. Replies
    11
    Views
    1,350

    Brilliant, thanks a lot, this works very well.

    Brilliant, thanks a lot, this works very well.
  15. Replies
    11
    Views
    1,350

    Sorry, but I don't know what either of those...

    Sorry, but I don't know what either of those would do or where to implement them.
  16. Replies
    11
    Views
    1,350

    Converting Strings of Numbers to Integers

    How would I go about changing a string of numbers like "2546" and return the integer value 2546.

    This is what I have so far (this is just my function to convert the string to an integer)

    The 48...
  17. Replies
    11
    Views
    1,399

    If you're suggesting that it's not necessary to...

    If you're suggesting that it's not necessary to have these in the code, then I get your point, but I'm just going with what the compiler says. I get 0 on the assignment if it doesn't compile...
  18. Replies
    11
    Views
    1,399

    It says there's a parse error if I don't put the...

    It says there's a parse error if I don't put the semi-colon there, which I know is strange, but it shuts the compiler up. I took it out and still had the same problems, so that's not what's...
  19. Replies
    11
    Views
    1,399

    #include using namespace std; ...

    #include <iostream>

    using namespace std;

    int getItemPrice()
    {
    int price;
    // making sure cost is not negative
    do
    {
  20. Replies
    11
    Views
    1,399

    I just tried getItemPrice in another program and...

    I just tried getItemPrice in another program and it did work, I tried every order of negative, non-multiples of 5, and other numbers that I could and it worked every time.

    As for the other things,...
  21. Replies
    11
    Views
    1,399

    Returning A Value From a Seperate Function

    If I had the program:



    #include <iostream>

    using namespace std;

    void getItemPrice()
    {
  22. Thread: Prime Factors

    by Adrian
    Replies
    3
    Views
    1,180

    I'm not sure how to keep track of something like...

    I'm not sure how to keep track of something like that though, however, that is the same idea I had.

    Wait, I could go n/k= first

    And then output would be cout << k << " ^ " << "first"

    I'll...
  23. Thread: Prime Factors

    by Adrian
    Replies
    3
    Views
    1,180

    Prime Factors

    I have a program that will find prime factors of any input number



    #include <iostream>

    using namespace std;

    int main()
    {
Results 1 to 23 of 23