User Profile

Collapse

Profile Sidebar

Collapse
zelmila19
zelmila19
Last Activity: May 7 '08, 12:05 PM
Joined: Apr 2 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • zelmila19
    started a topic getting rid of warning: C4244
    in C

    getting rid of warning: C4244

    Hello, this part of my program:

    int shotDistance(in t a)
    {
    int min = a * .8, max = a * 1.2; //Defines the minimum and maximum range of the club.
    srand ((unsigned int) time(NULL));
    a = min + (rand() % (max - min)) ; //calculates the random shot distance.

    return a; //returns the distance to main().

    }

    gives warning:C4244 'initializing' : conversion from 'double'...
    See more | Go to post

  • zelmila19
    replied to Program check - help
    in C
    How do i do that????...
    See more | Go to post

    Leave a comment:


  • zelmila19
    started a topic Program check - help
    in C

    Program check - help

    Hi anyone,
    Could someone check this program for me, I've given it a go, it runs well but gives me 6 of this warning:

    warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data

    Please check this and let me know if I've left out anything or any additions, anything:


    #include <iomanip>
    #include <iostream>
    #include <string>
    ...
    See more | Go to post

  • zelmila19
    replied to C++ - formula in a while loop
    in C
    Thanks guys but i still cant get the expected results cos I do not know how to code the calculations for the total sales and average sales.......cou ld someone give me an idea on how to do that???...
    See more | Go to post

    Leave a comment:


  • zelmila19
    replied to C++ - formula in a while loop
    in C
    No am not trying to implement a for loop I just want to use a while loop but I want the months to automatically just come as Month1...Month2 ...etc.
    The program is giving me this warning:

    warning C4552: '<=' : operator has no effect; expected operator with side-effect...
    See more | Go to post

    Leave a comment:


  • zelmila19
    started a topic C++ - formula in a while loop
    in C

    C++ - formula in a while loop

    How do i write the formula for calculating the total sales and average for this program:

    [code=cpp]
    while (sales !=-1)
    {
    i <= 12; i++;
    cout << fixed << setprecision(2) << "Please enter your sales for month " << i << ": ";
    cin >> sales;
    } //end while

    i <= 12; i--;
    cout << "For " <<...
    See more | Go to post
    Last edited by sicarie; Apr 21 '08, 01:06 PM. Reason: Code tags are [code=cpp] and after your code [/code]. Please use them. They want to be used. They like to be used.

  • zelmila19
    started a topic using a while loop
    in C

    using a while loop

    Hi can anyone tell me how to do this problem:

    Write a program using a while loop that asks the user to enter their sales for each month until they enter -1 (sentinel value). After this, it should tell the user how many months, the total sales and the average sales.
    If the user enters a negative value as the first input, it should not cause an error.
    The program should be able to produce the output below:

    ...
    See more | Go to post

  • Thanks the semi-colon fellow :)...
    See more | Go to post

    Leave a comment:


  • zelmila19
    started a topic Logical error - same output no matter what the input
    in C

    Logical error - same output no matter what the input

    Hi,
    Can someone tell me what's wrong with my code cos when I test the program, it always gives me the fee as 20 for everything..... .

    [code=cpp]
    #include <iostream>

    using std::cout;
    using std::cin;
    using std::endl;

    int main()
    {
    //declare variables
    char memberStatus = ' ';
    int age = 0;
    int fee = 0;
    ...
    See more | Go to post

  • zelmila19
    replied to selection structure problem
    in C
    oh whoops my bad, thanks.... :)...
    See more | Go to post

    Leave a comment:


  • zelmila19
    replied to selection structure problem
    in C
    Thank you, now it doesnt have errors but it's not giving the value :(...
    See more | Go to post

    Leave a comment:


  • zelmila19
    replied to selection structure problem
    in C
    This is the error am getting:

    error C2451: conditional expression of type 'std::basic_str ing<_Elem,_Trai ts,_Ax>' is illegal
    with
    [
    _Elem=char,
    _Traits=std::ch ar_traits<char> ,
    _Ax=std::alloca tor<char>...
    See more | Go to post

    Leave a comment:


  • zelmila19
    started a topic selection structure problem
    in C

    selection structure problem

    Hi
    I have to create a program that displays a shipping charge. The shipping charge is based on the state name entered by the user, as shown:
    State
    Shipping charge ($)
    Alabama
    25
    Alaska
    50
    If the user enters any other state name, the shipping charge should be 0 (zero).
    So far I've come up with this but am having errors. Can someone help check my code out?

    #include <iostream>
    #include...
    See more | Go to post

  • zelmila19
    started a topic program converting Celsius to Fahrenheit
    in C

    program converting Celsius to Fahrenheit

    Hi
    I was doing this program on Visual Studio 2005 where the program converts C to F and vise versa but after debugging it, it doesnt give the expected result. Could someone tell me what is wrong with my code???


    #include <iostream>
    #include <iomanip>

    using namespace::std;
    using std::fixed;

    int main()
    {
    int conversionType = 0;
    double temp...
    See more | Go to post

  • zelmila19
    started a topic Help, am getting this error C2784 message
    in C

    Help, am getting this error C2784 message

    Hi am working on this program that will display the sum, difference, product and quotient of two numbers using the selection structures. This is what I did:


    #include <iostream>

    using std::cout;
    using std::cin;
    using std::endl;

    int num1 = 0;
    int num2 = 0;
    int answer = 0;
    char operation;

    int main()
    {
    cout << "Enter...
    See more | Go to post

  • zelmila19
    started a topic error C2065
    in C

    error C2065

    Hi,
    I'm doing C++ with visual studios 2005 and recently did this program


    #include <iostream>

    int num1;
    int num2;
    int answer;
    char operation;

    int main()
    {
    cout << "Enter first number: ";
    cin >> num1;
    cout >> "Enter 1 (add) or 2 (subtract) or 3 (multiply) or 4 (divide): ";
    cin >> operation;...
    See more | Go to post
No activity results to display
Show More
Working...