1 Replies - 315 Views - Last Post: 03 January 2012 - 04:27 AM Rate Topic: -----

#1 VcarlaV  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-January 12

error ...

Posted 03 January 2012 - 04:22 AM

# include <iostream>
using namespace std;
int n;
int main ()
{
	cout<<"n=";cin>>n;
    case (n)
	case (1): cout<<"luni"
	case (2): cout<<"marti"
	return 0;
}



it says : error syntax error before 'case'
it is in Ming and I don't usually get annoying errors

This post has been edited by no2pencil: 03 January 2012 - 04:29 AM
Reason for edit:: Added code tags

Is This A Good Question/Topic? 0
  • +

Replies To: error ...

#2 sk1v3r  Icon User is offline

  • D.I.C Addict

Reputation: 231
  • View blog
  • Posts: 668
  • Joined: 06-December 10

Re: error ...

Posted 03 January 2012 - 04:27 AM

I think you want a switch statement
switch(a)
{
case 1:
    cout << "a = one";
    break;
case 2:
    cout << "a is two";
    break;
default:
    cout << "a is neither one nor two";
    break;
}


Was This Post Helpful? 2
  • +
  • -

Page 1 of 1