473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

cannot run programme

i cannot run this programme can any one tell me why.
Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. void main()
  3. {
  4. char grade;
  5. cout<<"pls key:";
  6. cin>>grade;
  7. switch(grade)
  8. {
  9. case 'a':
  10. cout<<"minimum is 30\n";
  11. break;
  12. case'b':
  13. cout<<"minimum is 20\n";
  14. break;
  15. default:
  16. cout<<"minimum is 10\n";
  17. }
  18. }
Mar 22 '08 #1
1 1041
sicarie
4,677 Expert Mod 4TB
Did your compiler tell you why you couldn't?

3 things you should do in your C++ programs:

1) do not use the .h after iostream - it's depricated.
2) main is an int, not a void, and you need a return type (standard is 0) at the end of the program.
3) Specify/declare your namespace. For beginners, 'using namespace std;' will suffice after your library declarations.

Your compiler might be complaining about these things, mine certainly allowed your code to compile and execute after I changed these things.
Mar 22 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Oliver Hoehle | last post by:
Hello! When I try to start jboss, i get the message: .... 11:55:52,549 ERROR MBeanException: Exception in MBean operation 'checkIncompleteDeployments()' Cause: Incomplete Deployment...
0
by: cm012b5105 | last post by:
Hello i want to put an interactive text programme in to a graphical box this is a small section of my text programme s = raw_input ("Hello whats your name? ") if s=='melvyn': print "your my...
2
by: NDAKI MBOULET | last post by:
J'ai un problème pour écrire un programme. Voici mon sujet: Ecrire en c++ un programme qui reçoit en entrée une suite d'instruction encadrées par les mots clés BIBODLE et LISUK dans un langage...
6
by: =?ISO-8859-1?Q?FERHAT_A=C7ICI?= | last post by:
hi everyone...I want to run any programme or file with my programme.example any file or programme, like this "xxx.ncn".I want If users double click this xxx.ncn this file can run by my...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.