User Profile

Collapse

Profile Sidebar

Collapse
mssprogram
mssprogram
Last Activity: Apr 4 '07, 07:27 PM
Joined: Apr 4 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • It seems like it should work, but apparently it doesn't. Thanks for your help.
    See more | Go to post

    Leave a comment:


  • I see what you're saying about 90-100. Thanks. However, I tried this without success:

    switch (ave)
    {
    case 'ave >= 90':
    cout << "Your score is " << ave << " and your grade is an A." << endl;
    break;
    case 'ave >= 80 && ave < 90':
    cout << "Your score is " << ave << "...
    See more | Go to post

    Leave a comment:


  • Thanks for your help, but I just don't understand what you're saying. I've tried the following:

    case 'ave >= 90'

    but it didn't work.


    I read through the section on switch statements. It said you cannot use a variable nor ranges as case values, which is what I appear to be doing. I searched that site and didn't get any hits on "conditiona ls". I don't know what "conditiona ls"...
    See more | Go to post

    Leave a comment:


  • So you're saying it is impossible to use the switch statement to do what I'm trying to do?...
    See more | Go to post

    Leave a comment:


  • mssprogram
    started a topic Allowable Case Values in a Switch Statement?
    in C

    Allowable Case Values in a Switch Statement?

    I'm using Bloodshed's Dev-C++. I can't get this code to work. Can someone tell me what's wrong?
    Code:
    [B]int a, b, c, ave;
        cout << "Enter three test scores: " << endl;
        cin >> a >> b >> c;
        ave = (a + b + c)/3;
        switch (ave)
        {
        case '90-100':
             cout << "Your score is " << ave << " and your grade[/]
    ...
    See more | Go to post
    Last edited by sicarie; Apr 4 '07, 06:20 PM. Reason: Please use [code] and [/code] tags around your code.
No activity results to display
Show More
Working...