CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: cozySam

Search: Search took 0.02 seconds.

  1. Re: How to make a program that guesses what number I'm thinking of?

    I need to set the first to be greater than last? That should stop it.

    But I used a return instead. This is what I have now:


    int main()
    {
    // Create an array of 100 elements
    int...
  2. Re: How to make a program that guesses what number I'm thinking of?

    I almost have it now. But I keep going around the loop even after finding the correct number. How do I prevent this?



    int main()
    {
    // Create an array of 100 elements
    int arr[100];
    ...
  3. Replies
    3
    Views
    5,952

    Re: Array of 100 elements ranging from 1 to 100

    I think I found the problem. Here is the solution:



    int main()
    {
    int arr[100];

    // For setting values to elements
    for (int i = 0; i < 100; i++)
  4. Replies
    3
    Views
    5,952

    Array of 100 elements ranging from 1 to 100

    Hello!

    I'm trying to create an array of 100 elements, ranging from 1 to 100.


    int main()
    {
    int arr[100];

    // For setting values to elements
  5. Replies
    5
    Views
    4,020

    Re: Rounding vs. truncation?

    Integer division and integer quotient! That's interesting. I suppose that's a completely different way to view this.

    But you got me confused by (dividend -= divisor). How should I read this, from...
  6. Replies
    5
    Views
    4,020

    Rounding vs. truncation?

    Hello!


    #include <iostream>
    using namespace std;

    int main()
    {
    int a = 9;
    int b = a/2;
  7. Replies
    14
    Views
    1,669

    Re: Function with input but no output?

    I have learned some programming fundamentals on my own and I took a basic Python course before I started with this C++ course.



    Yes, it's from the C++ course I'm taking. It's from the course...
  8. Replies
    14
    Views
    1,669

    Re: Function with input but no output?

    Alright, so this is what I think might be going on.

    This is what the address range for the char vector nameVector might be and what the values might be.


    Address Value
    =================...
  9. Replies
    14
    Views
    1,669

    Re: Function with input but no output?

    This is also the confusing part for me. How does the compiler store the literal "John" in memory? As a char vector? So this is why I don't have to declare a new char vector e.g. char nameVector[];...
  10. Replies
    14
    Views
    1,669

    Re: Function with input but no output?

    Let me quote 2kaud here, maybe you will see what I mean.
  11. Replies
    14
    Views
    1,669

    Re: Function with input but no output?

    Alright, so name is a char pointer. And where is it pointing to? Where is the char that cahr* points to?

    Why is there no char declaration?
  12. Replies
    14
    Views
    1,669

    Function with input but no output?

    Hello!

    This function is supposed to have input but no output. I really want to understand how this works. Can someone help me fill in the gaps?


    #include <iostream>

    using namespace std;
    ...
  13. Re: How to make a program that guesses what number I'm thinking of?

    I have covered while loops, and I have seen for loops in other examples with other languages. But I have not worked with it yet with C++ in this course.
  14. Re: How to make a program that guesses what number I'm thinking of?

    The second example worked for me. So it needed that inclusion.
  15. Re: How to make a program that guesses what number I'm thinking of?

    I am using Code Blocks with MinGW (GCC) compiler.
  16. Re: How to make a program that guesses what number I'm thinking of?

    Can someone work through the "binary search" alg. with me here mentally? What's going on? How does it work? I know intuitively how it works, but I want to see the math in this.

    So the range is 1...
  17. Re: How to make a program that guesses what number I'm thinking of?

    #include <iostream>

    using namespace std;

    int main()
    {
    cout << "Think of a number between 1 and 100. Press ENTER when ready." << endl;

    int answer, currentNumber=50;
  18. Re: How to make a program that guesses what number I'm thinking of?

    Do I have to store the return value from cin before I use it in a test?


    cin >> a;

    if(a<b)
    {
    cout << "Hello!";
    }
  19. Re: How to make a program that guesses what number I'm thinking of?

    "Error! System was not declared in this scope."

    I hve put it in the main, right after the first printout line.
  20. Thread: Edit button

    by cozySam
    Replies
    4
    Views
    4,105

    Edit button

    Hello!

    Perhaps an edit button would be a good idea?
  21. Replies
    2
    Views
    10,560

    Re: Testing editing

    No edit button?... alright, good to know.
  22. Replies
    2
    Views
    10,560

    Re: Testing editing

    Replying to thread...

    "This forum requires that you wait 30 seconds between posts. Please try again in 7 seconds."

    ok...
  23. Replies
    2
    Views
    10,560

    Testing editing

    Lorem lorem lorem
  24. Re: How to make a program that guesses what number I'm thinking of?

    How do I make a program pause and wait for me to press a key before it continues?

    Right after the first printout I want it to pause, and then continue when I have pressed Enter. How do I do that?
  25. How to make a program that guesses what number I'm thinking of?

    Hello everyone!

    I am new to these forums. I come here today because I need help with a C++ programming assignment for school, and in the long term I also hope to find some mentors and friends...
Results 1 to 25 of 25





Click Here to Expand Forum to Full Width

Featured