473,382 Members | 1,635 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,382 software developers and data experts.

expected ; before string constant

Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<conio.h>
  3. main ()
  4. {
  5.      int vote, bakar=1, yahaya=2, fatimah=3,abdullah=4,total=0,numB,numY,numF,numA;
  6.      float percent;
  7.      cout<<"Enter your vote:"<<endl;
  8.      cin>>vote;
  9.      {
  10.    while (vote!=0)
  11.    if(vote==1)
  12.    {
  13.          numB=numB+1;
  14.          total++;
  15.          }
  16.    else if(vote==2)
  17.    {
  18.         numY=numY+1;
  19.         total++;
  20.         }
  21.    else if (vote==3)
  22.    {
  23.         numF=numF+1;
  24.         total++;
  25.         }
  26.     else
  27.     {
  28.         numA=numA+1;
  29.         total++;
  30.         }
  31.         cout<<"Enter your vote:"<<endl;
  32.         cin>>vote;
  33.         }
  34.         cout.precision(2);
  35.         cout.setf(ios::fixed,ios::floatfield); 
  36.  
  37.         percent=(vote*100)/total;
  38.  
  39.         cout<<"Name\t\t"<<"Number\t\t"<<"Percent\t\t";
  40.         cout<<"Bakar\t\t"<<numB"\t\t"<<percent"\t\t"
  41.         cout<<"Yahaya\t\t"<<numY"\t\t"<<percent"\t\t"
  42.         cout<<"Fatimah\t\t"<<numF"\t\t"<<percent"\t\t"
  43.         cout<<"Abdullah\t\t"<<numA"\t\t"<<percent"\t\t"
  44.  
  45.         getche ();
  46.         }
Mar 20 '13 #1
1 9512
Banfa
9,065 Expert Mod 8TB
Lines 40-43 your cout statements are not formatted correctly.

Missing << and ;
Mar 20 '13 #2

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

Similar topics

3
by: Senthilraja | last post by:
I am able to compile the following code and get "hello" as ouput everytime I execute it:- #include <stdio.h> int main (void) { char *str; str="hello"; puts(str); return 0;
11
by: Gnik | last post by:
I created a C# application with some large string constants and whenever I try to build the solution the compiler crashes with no error message. On further analysis the problem seems to occur when...
1
by: Paul Steckler | last post by:
I'm using a managed C++ class that wants an unsigned char __gc as input. Is there a way to easily populate that array from a string constant (or wide string constant, etc.)? I'd like to do...
18
by: William | last post by:
I have the following javascript function that updates a scroll_list and sends the updated entry (with its index) to a server script ( i.e. http://mkmxg00/cgi/confirmUpload.pl ) for further...
2
by: polilop | last post by:
When i open my page in IE it shows an error Unterminated string constant om Line..... When i look at the line it shows the line where the </SCRIPT> tag is ???? Moziila dose not see this error,...
10
by: Steve Pope | last post by:
The first of the following functions compiles, the second gives what I think is a spurious error: "cannot convert `const char' to `char *' in assignment". void foo(int m) { char *str; if (m...
5
by: ken s | last post by:
From server-side code I'm using Response.Write to display a javascript alert box. It works fine except when I try to include a new line character, which causes this javascript error: ...
20
by: karthikbalaguru | last post by:
Hi, String constant being modifiable in C++ but, not modifiable in C. that is, In C++, the following example output will be "Mplusplus" char *str1 = "Cplusplus"; *str1 = 'M'; In C, the above...
3
hemantbasva
by: hemantbasva | last post by:
i have written a the following javascript code to copy data onto clipboard but i am getting error Unterminated string constant code in cs file if (lblProcedureID != null) ...
3
by: Elohim | last post by:
Hi to everybody, I'm a learner of C++. I'll really appreciate if you can help me or teach me something. Thank you in advance. #include<iostream> #include<string> int main() { ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.