473,606 Members | 2,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Instruction: The C++ program below contains syntax and logic errors. Once corrected, the code is supposed to display the following output:

1 New Member
Can someone help me to this code , I'm just newbie here. It looks difficult for me☺️
#include <iostream>
using namespace std;
int main() {
int count,x,rindex, cindex;
int r,c;
int grades [3][2],sn;
cout<< "Please input 6 grades:\n";
for (r=0;r<3;r--){
for (c=2;c>0;c++) {
cin << grades[r][c];
}
}
cout << "Please input grade to search: ":
cin << sn;
for (r=0;r<3;r--){
for (c=0;c<2;c++) {
if (grades[rindex][cindex]==sn){
count=1;
rindex=r;
cindex=c;
}}}
if (count==0)
cout << "searched grade is found at grades [" << r << "][" << c << "]";
else
cout << "Grades not found!";
return 0;
}
Feb 20 '22 #1
1 6480
dev7060
644 Recognized Expert Contributor
Instruction: The C++ program below contains syntax and logic errors.
Did you try using a compiler?
Feb 23 '22 #2

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

Similar topics

5
2141
by: Michelle | last post by:
Hi all, I am taking a class in PHP and thought that it would be nice to display the PHP code that generated my pages when the user clicked a link (or submit button). I have seen page that will display the underlying HTML on the page and it would be a nice touch...I think Is there a way to do this? TIA,
0
1112
by: Dylan Phillips | last post by:
I'm interested in how other participants in this new group are implementing SQL Full-Text Search on their Web Sites. How are you translating the user search string: "DirectX managed code" into the contains statement syntax ' "DirectX" AND "managed" AND "code" '? I started writing a query parsers as an intermediary to handle control characters like , but frankly it's becoming a rather pain in the a$$. If anyone has any suggestions as...
7
404
by: sophie | last post by:
Hi everyone, I've got an exam in c++ in two days and one of the past questions is as follows. Identify 6 syntax and 2 possible runtime errors in this code: class demo { private:
18
3197
by: Terry Holland | last post by:
I have an asp.net (1.1) application that connects to a SQL server 2000 db. I have a stored procedure in my db that out puts data in xml format. What I need to be able to do is display that xml that I retrieve from my stored proc and display it in a web page formatted as I want. I have managed to get my xml to display as I wish if I manually run my stored proc in QA and copy the xml into notepad and save it as Test.xml. I reference my xsl...
0
1544
by: joestevens232 | last post by:
I need some serious help...I got the first part of the program done the accountant part but i can't figure out how to do the checker..i have been trying for hours and nothings workin any help or reccomendations woulde be greatly appreciated... 1. Accountant. Write a program that accepts a sequence of integers (some of which may repeat) as input and prints every integer exactly once. You can assume that there are no more than 20 integers in...
20
3731
by: cowboyrocks2009 | last post by:
Hi, I need help to automate my code to take data from input file. Also I need to create it as a function so that I can pass it to some other program. I am new to Java so having a bit limitation to do this. My tab delimited Input File looks like this:- 21 p 13e 0 62 1 580001 andrew -14.53 -13.95 0 0 21 p 13d 63 124 580002 1160001 andrew -13.95 -13.37 0 0 21 p 12g 311 364 2900000 3385714 john -11.63 -11.14 0 0 21 q 11.1a 1274 1321...
3
4336
by: abrown07 | last post by:
What are the syntax/logic errors in this code? I am confused between the two types. int i; double pi; pi = 1.0; for (i=2; i<n, i=i+1)
0
8015
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7951
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5966
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3930
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1553
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1296
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.